Questions tagged [pidof]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
1
vote
0answers
87 views

pidofproc or pidof working from init.d but not from /usr/sbin

I have a Linux service I'm supporting. It offers the usual start and stop commands. The designer created a wrapper command that is meant to control startup and retries of the main function. The ...
2
votes
1answer
169 views

Why is pidof not working?

In the output of ps aux, I can see the process just fine: # ps aux | grep diff root 7787 28.7 0.0 9368 4516 pts/3 D+ 13:56 20:33 diff -qr mnt/mnt/md/ mnt/mnt2/ root 13130 0.0 0.0 ...
0
votes
0answers
391 views

<pidof> Command not showing all Java processes

I noticed that the command in my case, is not listing all Java processes. If I run pidof java I get one single pid as a response. On the other hand, if I run ps aux | grep [j]ava I get a three ...
0
votes
1answer
485 views

Process name 'masked' by /usr/bin/python and /bin/su

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 ...
2
votes
1answer
2k views

How do I check for the existence of a process without a failed exit code being returned?

I’m using Amazon Linux. I want to start a process provided one isn’t running already. This is a bash script I embed within a Jenkins Maven job. So I have pids=$(pidof /usr/bin/Xvfb) if [ ! -n "$...
0
votes
2answers
2k views

Find ProcessID - pidof not working

I need to try and find the ProcessId of a process. Initially I was doing: application="/home/user/apps/appName.app" appPid=$(pidof -x $application) This worked fine. However, it now turns out that ...
1
vote
3answers
2k views

How can I format output of shell command

I combine top and pidof command: top -p $(pidof <process_name>) If pidof <process_name> return one id top command works. But if pidof <process_name> more than one ids top command ...
3
votes
1answer
586 views

What could be happening between pidof and kill to cause “no such process”?

I've inherited quite a bit of code and am looking at a cron job that restarts a service once an hour, no other scripts touch this process and this code is ran. #The name of the process has been ...
2
votes
3answers
2k views

Are there any alternatives to pidof? (smaller footprint)

Well, I've just found out that with extensive usage of pidof in very short intervals, the seemingly tiny tool can be a great CPU hog. (Source: top) On my older machine, it can easily reach 30 percent ...
8
votes
3answers
10k views

Why pidof and pgrep are behaving differently?

I have a init script in /etc/init.d/myservice for initialize a service like this: ... start() { ... daemon /usr/sbin/myservice ... } stop() { ... pgrep myservice pidof myservice ps -ef ...
5
votes
3answers
5k views

How to poll existence of a background script correctly

I have a problem with the following kind of script: #!/bin/sh long_running_script.sh & while [ `pidof long_running_script.sh` ] do echo "." sleep 1 done The sript will ...
2
votes
1answer
2k views

Using `pidof` with `sh -c`

I was wondering why this command line does not print pidof sh: $ sh -c "var=`pidof sh` ; echo \$var; ps -H" This one prints 123 as expected $ sh -c "var=123 ; echo \$var; ps -H" I am on Ubuntu ...