Process name 'masked' by /usr/bin/python and /bin/su
0
votes
1
answer
1068
views
I'm trying to use the
pidof
command to see my script is already running as I only want this executable if the script is not already running, however, it seems the pidof
command is not returning the *pid* of the script using the name which is displayed in ps -ef
output. Instead it is masking this name as either /usr/bin/python
or /bin/su
. Can someone shed some light on what is going on and how I can run pidof 'script.py -v'
to see if the script is running or not?
[root@cloud proc]# pidof python /some/dir/script.py -v
> pidof: invalid options on command line!
[root@cloud proc]# pidof "python /some/dir/script.py -v"
>
[root@cloud proc]# pidof "su - user -c python /some/dir/script.py -v"
>
[root@cloud proc]# ps -ef | grep script.py
> root 5409 31739 0 13:07 pts/1 00:00:00 su - user -c python /some/dir/script.py -v
> user 5414 5409 96 13:07 ? 01:00:40 python /some/dir/script.py -v
[root@cloud proc]# ls -l /proc/5409/exe
> lrwxrwxrwx. 1 root root 0 Oct 13 14:04 /proc/5409/exe -> /bin/su
[root@cloud proc]# ls -l /proc/5414/exe
> lrwxrwxrwx. 1 user user 0 Oct 13 14:04 /proc/5414/exe -> /usr/bin/python
[root@cloud proc]# pidof /bin/su
> 31715 6308 5409
[root@cloud proc]# pidof /usr/bin/python
> 5414
Asked by AlanK
(361 rep)
Oct 13, 2016, 01:21 PM
Last activity: Oct 13, 2016, 06:29 PM
Last activity: Oct 13, 2016, 06:29 PM