Questions tagged [pgrep]
The pgrep tag has no summary.
33 questions
0
votes
0
answers
47
views
pgrep executable matching specific (current) user only
In a code review on Final look at my Lightshot print screen Linux handler POSIX shell script, specifically in this short answer, it has been pointed out to me, that if there are multiple X servers ...
-1
votes
1
answer
94
views
Why a process can own 3 names in Linux?
We migrated an app, changed its name in Makefile from flex_camera to flex_camera_lucid.
After deploying it to the target board(the original app is removed), as shown in the following screenshot, we ...
1
vote
1
answer
428
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 ...
2
votes
1
answer
60
views
Why does "pgrep -O 600" fail in an LXC? procps bug?
Debian 12.2 in an unpriviledged LXC (proxmox). It's almost 11:45 AM local time. At 5:00 AM in the morning, cron started a script:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME ...
-2
votes
1
answer
654
views
How to find one of multiple processes with the same name using pgrep (or another tool)? [closed]
I have several bash scripts running. The only thing that differs between them is the pid. I want to write a script like this that only monitors one specific bash process and exclude any daughter ...
1
vote
0
answers
77
views
Why does pgrep return randomly a wrong pid? [duplicate]
In the past I used pid-files to guarantee race-condition safe execution of scripts. But this had the downside, that the pid-file was not deleted if the kernel killed the script somehow. So sometimes ...
0
votes
2
answers
417
views
How to use 'pgrep' from a script, when the checked process includes a '-c' (that 'pgrep' considers an argument)? [duplicate]
The following script demonstrates my problem, which is to determine if the sox_user_auditd_v2r -c process is running:
$ cat ./pgrep_stackexchange_sample.bash
#!/bin/bash -xv
quoted="\'$@\'"
...
1
vote
1
answer
154
views
How to prevent 'pgrep' to consider the expression it checks as containing arguments for it?
I have the following script; it is supposed to start a process if it is not running:
$ cat keepalive_stackexchange_sample.bash
#!/bin/bash -xv
# This script checks if a process is running and starts ...
2
votes
3
answers
422
views
Find all Processes Except These Specific Ones
Is there a ps or pgrep option or standard practice what will let me list all the running processes on a machine EXCEPT for a few specific ones I don't want to see?
Put another way -- let's say I have ...
2
votes
1
answer
249
views
$(pgrep -f) behaviour changes within a script depending on the shebang
When I run the following script:
#!/bin/bash
$(pgrep -u ubuntu -f ${1} > /dev/null)
echo "CURRENT_STATUS="${?}
with:
./my_script.sh top
when top is not running, it returns:
...
0
votes
1
answer
287
views
Why does pgrep not find systemd-resolved?
#!/usr/bin/env bash
echo "pgrep not finding systemd-resolved has bitten many times."
if [ -z $(pgrep systemd-resolved) ]; then
echo -e "systemd-resolved not found by pgrep, trying ...
2
votes
2
answers
1k
views
Autokey - Focus App Window If Running, Launch App If Not
I'm trying to obtain the processID of pcmanfm like this:
pgrep -f "pcmanfm"
When pcmanfm is not running, the command above returns nothing (as I expect).
However, when I run the command ...
0
votes
1
answer
4k
views
how to use pgrep to find a shell script process
I want to use pgrep command to terminate the running process in centos terminal. I tried:
pgrep fedora-proxy-k8s-postgresql | xargs -r kill -9
and I could not found the process because it's a bash ...
1
vote
1
answer
1k
views
Don't understand why pgrep doesn't work in a bash script with sudo
I'm trying to detect whether the zoom program is running. I also need sudo privileges in my bash script to install it with dpkg.
If I use pgrep -f "zoom" >/dev/null 2>&1, the ...
1
vote
0
answers
281
views
Why pgrep hangs when clang AddressSanitizer library is preloaded using LD_PRELOAD?
I noticed that when I set LD_PRELOAD env. variable to libclang_rt.asan-x86_64.so pgrep hangs.
Why is this happening and how to avoid this?
senx:/$ time pgrep anything
real 0m0,022s
user 0m0,...