mirror of
https://github.com/openwrt/packages.git
synced 2026-10-13 01:27:31 +04:00
ripe-atlas: restart the probe on config changes
Restart the probe when /etc/config/ripe-atlas changes. procd does not
restart an instance when any of these options changes, and up to OpenWrt
25.12, when it stops one, it signals only the main script, so the
measurement daemons, the ssh tunnel and telnetd would keep running. Stop
and start the whole service instead.
On stop, take the processes from the instance's cgroup, which holds
exactly those of the probe, and fall back to the ripe-atlas group only
when it holds none.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
(cherry picked from commit 37b343293b)
This commit is contained in:
1 file changed
+26
-2
@@ -211,17 +211,41 @@ stop_service()
|
||||
{
|
||||
local pids
|
||||
local pid
|
||||
local procs
|
||||
|
||||
for pid in $(find /proc -type d -maxdepth 1 -group ${GROUP} -print); do
|
||||
pids="${pid##*/} ${pids}"
|
||||
# Up to OpenWrt 25.12, procd signals only the main script; the daemons,
|
||||
# the ssh tunnel and telnetd it started would keep running. Take them
|
||||
# from the instance's cgroup, or, when that holds none, from the group
|
||||
# only the probe uses.
|
||||
for procs in /sys/fs/cgroup/services/ripe-atlas/*/cgroup.procs; do
|
||||
[ -f "${procs}" ] || continue
|
||||
while read -r pid; do
|
||||
pids="${pid} ${pids}"
|
||||
done < "${procs}"
|
||||
done
|
||||
if [ -z "${pids}" ]; then
|
||||
for pid in $(find /proc -maxdepth 1 -type d -group ${GROUP} \
|
||||
2> /dev/null); do
|
||||
pids="${pid##*/} ${pids}"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "${pids}" ]; then
|
||||
kill ${pids} 1>/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# procd would not restart the probe when its options change, and up to
|
||||
# OpenWrt 25.12, when it stops the instance, it signals only the main
|
||||
# script.
|
||||
reload_service()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger 'ripe-atlas'
|
||||
procd_add_validation validate_config
|
||||
}
|
||||
Reference in new issue
Block a user