Questions tagged [pidof]
14 questions
1
vote
1
answer
429
views
Why was pidof and pgrep removed from OpenSuse 15.5?
In openSuse leap 15.5, there are no packages offering pidof?
SysVinit-tools package were part of the OS bundle previosuly, but was removed in 15.5. So, is there any alternates without installing ...
0
votes
1
answer
740
views
Running pidof in a function
I want to detect whether my script is already running, so I use this:
pidof -o %PPID -x "$0" >/dev/null && echo 'already running!' && exit 1
That works. But I want it in ...
1
vote
0
answers
825
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 ...
4
votes
2
answers
4k
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
0
answers
564
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
1
answer
1k
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
1
answer
3k
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 "$...
1
vote
2
answers
4k
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
3
answers
4k
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 ...
2
votes
1
answer
1k
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
3
answers
5k
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 ...
10
votes
3
answers
11k
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
3
answers
8k
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 start ...
2
votes
1
answer
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 Linux....