You are not logged in.

#1 2014-06-12 10:19:12

DeltaKilo
Member
From: Russia, Tula
Registered: 2014-06-12
Posts: 6

Does Arch have any tool to check what services needs restart?

Does Arch have any tool to check what services needs restart after software update just like `checkrestart` from Debian flavoured distros or `needs-restarting` from Red Hat ones?

Offline

#2 2014-06-12 10:23:43

Awebb
Member
Registered: 2010-05-06
Posts: 6,275

Re: Does Arch have any tool to check what services needs restart?

I don't know of an Arch specific solution, and I think this should be handled by systemd (if you cannot find anything in the systemd documentation, open a bug report and request the feature). Until then, look at the result of a quick google query: http://ingvar.blog.redpill-linpro.com/2 … o-restart/

Offline

#3 2014-06-12 10:53:44

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Does Arch have any tool to check what services needs restart?

This command which could be improved with awk should display all processes which rely on a deleted/updated file. Then you only need to find the corresponding systemd service or maybe restart your x session

ps -p "$(sudo lsof -F pf | grep -a "^p\|^fDEL$" | uniq | grep -B1 "^fDEL$" | sed -n "s/^p\(.*\)/\1/p" | sort -n | uniq | tr \\n ' ' | sed 's/ *$//')"

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#4 2014-06-12 11:17:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Does Arch have any tool to check what services needs restart?

I got

  PID TTY          TIME CMD
  242 ?        00:00:04 X
  322 pts/3    00:00:27 mpv
  382 pts/2    00:01:19 firefox

after a restart.
Why?

Offline

#5 2014-06-12 12:00:49

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Does Arch have any tool to check what services needs restart?

Maybe there is some other temporary file that is not a library but deleted that slips through. I got my awk version now to replace my old hack code.

__pids="$(sudo lsof -F pfn | 
    awk '
        /^n/{ 
            # if this file is a deleted library or binary, show it
            if (del == 1 && match($0, "bin|lib")) {
                print pid; 
                del=0;
            } 
            del = 0;
        } 
        /^fDEL$/{ 
            # the next file is deleted
            del = 1;               
        } 
        /^p/{
            # we check a new process
            del = 0
            pid = substr($0, 2)
        }' | 
    sort -un |
    paste -sd ' '
)"  && [ -n "$__pids" ] && ps -p "$__pids" && unset __pids || unset __pids

Edit: Reorder logic, don't execute ps if no processes are found.

Last edited by progandy (2014-06-12 16:42:27)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#6 2014-06-12 16:35:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Does Arch have any tool to check what services needs restart?

$ ./script
error: list of process IDs must follow -p

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).

Offline

Board footer

Powered by FluxBB