]>
code.delx.au - monosys/blob - find-services-to-restart
3 function get_pids_to_restart
{
5 grep 'DEL\|(deleted)' | \
10 function find_service_for_pid
{
11 systemctl status
"$1" | \
17 function is_cron_child
{
18 if [ "$1" != "cronie.service" ]; then
21 if systemctl show cronie
-p MainPID |
grep -q "$2"; then
27 function echo_kill_pid
{
28 echo "sudo kill $1 # $(ps -p"$1" -o user=,cmd=)"
31 function echo_restart_service
{
32 echo "sudo systemctl restart $1"
35 for pid
in $
(get_pids_to_restart
); do
36 if [ "$pid" = 1 ]; then
37 echo "sudo systemctl daemon-reexec"
41 service
="$(find_service_for_pid "$pid")"
42 if is_cron_child
"$service" "$pid"; then
45 elif [ -n "$service" ]; then
46 echo_restart_service
"$service"