Directorio de artículos
-
- Antecedentes del problema
- comando pgrep
-
- documentación de ayuda
- Ejemplo de uso
-
- 1. Enumere el PID y el nombre del proceso del proceso coincidente (-l) (de forma predeterminada, solo se puede hacer coincidir un subconjunto del nombre del proceso. Si desea utilizar un subconjunto del nombre del proceso completo, agregue el parámetro -f . Lo mismo a continuación. )
- 2. Enumere el PID y la línea de comando completa de los procesos coincidentes (-a)
- 3. Cuente el número de procesos coincidentes (-c)
- 4. Utilice un subconjunto del nombre completo del proceso (incluidos los parámetros) para hacer coincidir (-f) (si el patrón abarca comandos y parámetros del proceso, debe estar entre comillas dobles) ★★★★★
- 5. Coincidir sin distinguir entre mayúsculas y minúsculas (-i)
- 6. Seleccione el proceso iniciado más recientemente (n)
- 7. Seleccione el proceso iniciado más temprano (-o)
- 8. Hacer coincidir solo los procesos secundarios de un proceso principal determinado (-P)
- 9. Coincidencia a través del terminal de control (-t)
- 10. Coincidencia por identificación válida (-u)
- 11. Coincidencia por ID real (-U)
- 12. Coincide exactamente con el nombre del comando (-x) ★★★
Antecedentes del problema
Según mi método anterior, en un script obtengo el número de proceso con el mismo nombre que el script además del proceso propio del script:
ps -ef | grep "${SCRIPT_NAME}" | grep -v "grep" | awk '{print $2}' | grep -v "$PID"
Hay un gran problema con este método: inexplicablemente, no puede filtrar el proceso grep normalmente (es un poco complicado aquí y no pude entenderlo por un tiempo. Se dice que grep puede abrir procesos secundarios, no el proceso grep. Subproceso, pero abrió un proceso que es el mismo que el script, causando problemas. Para referencia específica: Problemas con la creación de subprocesos cuando los scripts de shell de Linux ejecutan comandos (en ciertas situaciones, como ejecución en segundo plano, tuberías, ramas o subshells , etc., el script puede crear un proceso hijo para ejecutar el comando) grep )
Más tarde, cambié al comando pgrep. La ventaja de usar este comando es que no es necesario usar el comando grep. Encuentra directamente el número de proceso y no trae números de proceso adicionales. Echemos un vistazo al uso específico del comando pgrep.
comando pgrep
El comando pgrep se utiliza para buscar y enumerar ID de proceso (PID) coincidentes según el nombre de un proceso u otros atributos. Permite encontrar y filtrar procesos flexibles en función de diferentes opciones.
documentación de ayuda
root@ubuntu:/ky/boot# pgrep --help
Usage:
pgrep [options] <pattern>
Options:
-d, --delimiter <string> specify output delimiter
-l, --list-name list PID and process name
-a, --list-full list PID and full command line
-v, --inverse negates the matching
-w, --lightweight list all TID
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-i, --ignore-case match case insensitively
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
-r, --runstates <state> match runstates [D,S,Z,...]
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
Traducción china:
root@ubuntu:/ky/boot# pgrep --help
用法:
pgrep [选项] <模式>
选项:
-d, --delimiter <字符串> 指定输出分隔符
-l, --list-name 列出PID和进程名称
-a, --list-full 列出PID和完整命令行
-v, --inverse 反转匹配结果
-w, --lightweight 列出所有TID
-c, --count 统计匹配进程的数量
-f, --full 使用完整进程名称进行匹配
-g, --pgroup <PGID,...> 匹配指定的进程组ID
-G, --group <GID,...> 匹配真实组ID
-i, --ignore-case 不区分大小写进行匹配
-n, --newest 选择最近启动的进程
-o, --oldest 选择最早启动的进程
-P, --parent <PPID,...> 仅匹配给定父进程的子进程
-s, --session <SID,...> 匹配会话ID
-t, --terminal <tty,...> 通过控制终端进行匹配
-u, --euid <ID,...> 通过有效ID进行匹配
-U, --uid <ID,...> 通过真实ID进行匹配
-x, --exact 精确匹配命令名称
-F, --pidfile <文件> 从文件中读取PID
-L, --logpidfile 如果PID文件未锁定,则失败
-r, --runstates <状态> 匹配运行状态 [D,S,Z,...]
--ns <PID> 匹配与<pid>相同命名空间的进程
--nslist <ns,...> 列出将用于--ns选项的命名空间
可用的命名空间:ipc, mnt, net, pid, user, uts
-h, --help 显示此帮助信息并退出
-V, --version 输出版本信息并退出
更多详细信息请参阅pgrep(1)。
Tenga en cuenta que lo anterior <pattern>
es un patrón de nombres de procesos u otros atributos que deben coincidir. Se puede reemplazar con un valor específico según la situación real.
Ejemplo de uso
Los siguientes son pgrep
ejemplos de uso de diferentes opciones del comando:
Probamos en este contenedor:
Nota: ¡Primero debemos aprender a distinguir cuál es el nombre de proceso de un proceso!
El nombre del proceso es el archivo ejecutable de ese proceso. Solo hay un nombre de proceso. Excepto el nombre del proceso, todo lo demás es la ruta y los parámetros.
Por ejemplo /bin/bash /usr/local/bin/entrypoint.sh
, el nombre del proceso esbash
root@5940438e0ee6:/build/libevent# echo "=====输出所有进程完整进程信息:"
=====输出所有进程完整进程信息:
root@5940438e0ee6:/build/libevent# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Jun27 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 7 1 0 Jun27 pts/0 00:02:56 ./kyai_rest
root 43 0 0 23:38 pts/1 00:00:00 /bin/bash
root 56 43 0 23:40 pts/1 00:00:00 ps -ef
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# echo "输出所有进程进程名:"
=====输出所有进程进程名:
root@5940438e0ee6:/build/libevent# ps -e -o comm=
bash
kyai_rest
bash
ps
root@5940438e0ee6:/build/libevent#
1. Enumere el PID y el nombre del proceso del proceso coincidente (-l) (de forma predeterminada, solo se puede hacer coincidir un subconjunto del nombre del proceso. Si desea utilizar un subconjunto del nombre del proceso completo, agregue el parámetro -f . Lo mismo a continuación. )
pgrep -l <pattern>
pgrep --list-name <pattern>
Ejemplo:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l ky
7 kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l ./
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l ./ky
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l -f ./ky
7 kyai_rest
2. Enumere el PID y la línea de comando completa de los procesos coincidentes (-a)
pgrep -a <pattern>
pgrep --list-full <pattern>
Ejemplo:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a ky
7 ./kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a ./ky
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a -f ./ky
7 ./kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -af ./ky
7 ./kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a bash
1 /bin/bash /usr/local/bin/entrypoint.sh
43 /bin/bash
root@5940438e0ee6:/build/libevent#
3. Cuente el número de procesos coincidentes (-c)
pgrep -c <pattern>
pgrep --count <pattern>
Ejemplo:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c ky
1
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c bash
2
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c ./ky
0
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c -f ./ky
1
root@5940438e0ee6:/build/libevent#
4. Utilice un subconjunto del nombre completo del proceso (incluidos los parámetros) para hacer coincidir (-f) (si el patrón abarca comandos y parámetros del proceso, debe estar entre comillas dobles) ★★★★★
pgrep -f <pattern>
pgrep --full <pattern>
Por ejemplo, si hay un proceso con el nombre completo python3 -u /ky/alg/kyai/nv/m/people/alg/main.py
, utilice:
pgrep -f <pattern>
Patrón es cualquier subconjunto de cadenas del nombre completo del proceso y puede coincidir.
Ejemplo 1
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -f ky
7
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -f ./ky
7
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep ./ky
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep /usr/local/bin/entrypoint.sh
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -f /usr/local/bin/entrypoint.sh
1
root@5940438e0ee6:/build/libevent#
Ejemplo 2
5. Coincidir sin distinguir entre mayúsculas y minúsculas (-i)
pgrep -i <pattern>
pgrep --ignore-case <pattern>
Ejemplo:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -i KyAi
7
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -i entry
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -i -f eNtry
1
root@5940438e0ee6:/build/libevent#
6. Seleccione el proceso iniciado más recientemente (n)
pgrep -n <pattern>
pgrep --newest <pattern>
Ejemplo:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a bash
1 /bin/bash /usr/local/bin/entrypoint.sh
43 /bin/bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a -n bash
43 /bin/bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -n bash
43
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
7. Seleccione el proceso iniciado más temprano (-o)
pgrep -o <pattern>
pgrep --oldest <pattern>
Ejemplo:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a bash
1 /bin/bash /usr/local/bin/entrypoint.sh
43 /bin/bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a -o bash
1 /bin/bash /usr/local/bin/entrypoint.sh
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -o bash
1
root@5940438e0ee6:/build/libevent#
8. Hacer coincidir solo los procesos secundarios de un proceso principal determinado (-P)
pgrep -P <PPID> <pattern>
pgrep --parent <PPID> <pattern>
Ejemplo:
Por ejemplo, el proceso No. 0 tiene dos subprocesos No. 1 y No. 2:
Utilice pgrep -P 0
el siguiente comando para encontrar los procesos secundarios del proceso 0:
root@ubuntu:~#
root@ubuntu:~# pgrep -P 0
1
2
root@ubuntu:~#
Filtrar procesos secundarios cuando se encuentren:
root@ubuntu:~#
root@ubuntu:~# pgrep -P 0 "system"
1
root@ubuntu:~#
root@ubuntu:~# pgrep -P 0 "thread"
2
root@ubuntu:~#
root@ubuntu:~#
Nota: Cuando a veces se utiliza el parámetro -f para hacer coincidir y filtrar segmentos de cadena que no son nombres de procesos, preste atención al uso de comillas dobles y a los problemas a los que aún se debe prestar atención después de usar comillas dobles:
En la siguiente prueba: pgrep -f -P 0 --system
y pgrep -f -P 0 "--system"
ambos reportaron errores, solo pgrep -f -P 0 " --system"
que no hubo ningún problema.
root@ubuntu:~#
root@ubuntu:~# pgrep -f -P 0 --system
pgrep: unrecognized option '--system'
Usage:
pgrep [options] <pattern>
Options:
-d, --delimiter <string> specify output delimiter
-l, --list-name list PID and process name
-a, --list-full list PID and full command line
-v, --inverse negates the matching
-w, --lightweight list all TID
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-i, --ignore-case match case insensitively
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
-r, --runstates <state> match runstates [D,S,Z,...]
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
root@ubuntu:~#
root@ubuntu:~# pgrep -f -P 0 "--system"
pgrep: unrecognized option '--system'
Usage:
pgrep [options] <pattern>
Options:
-d, --delimiter <string> specify output delimiter
-l, --list-name list PID and process name
-a, --list-full list PID and full command line
-v, --inverse negates the matching
-w, --lightweight list all TID
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-i, --ignore-case match case insensitively
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
-r, --runstates <state> match runstates [D,S,Z,...]
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# pgrep -f -P 0 " --system"
1
root@ubuntu:~#
root@ubuntu:~#
9. Coincidencia a través del terminal de control (-t)
usar
Un uso de la búsqueda especificando un nombre de terminal específico es limitar el alcance de la búsqueda. En un entorno multiusuario o multiterminal, puede haber varios terminales ejecutando el mismo proceso al mismo tiempo. Al especificar un nombre de terminal, puede buscar procesos coincidentes solo en un terminal específico, en lugar de en todos los terminales.
Esto es útil si necesita realizar acciones en un terminal específico o monitorear procesos en un terminal específico. Por ejemplo, es posible que desee buscar procesos para una aplicación que se ejecuta en un terminal específico o buscar procesos asociados con un usuario en un terminal específico.
Además, la especificación de un nombre de terminal se puede utilizar para la gestión de procesos en scripts o tareas automatizadas. Al especificar una terminal específica, puede garantizar que las operaciones solo se realicen en procesos en esa terminal específica, sin afectar los procesos en otras terminales.
En resumen, especificar nombres de terminales específicos para buscar proporciona un descubrimiento y una gestión de procesos más precisos y específicos.
Orden
pgrep -t <tty> <pattern>
pgrep --terminal <tty> <pattern>
Pasos de prueba
Siga estos pasos para probar:
- Abra una terminal.
- Ejecute
tty
el comando para obtener el nombre de la terminal actual. Por ejemplo, si el nombre del terminal es/dev/tty1
,<tty>
reemplácelo contty1
. - Ejecute
pgrep -t <tty> <pattern>
el comando y<pattern>
reemplácelo con el nombre del proceso o la palabra clave que desea encontrar. Por ejemplo, si desea encontrar todosbash
los procesos en ejecución, ejecutepgrep -t tty1 bash
. - Si el comando se ejecuta correctamente, generará el ID del proceso coincidente.
- También puedes intentar ejecutar
pgrep --terminal <tty> <pattern>
el comando, que hace lo mismo que el comando anterior.
Tenga en cuenta que pgrep
el comando se utiliza para buscar procesos coincidentes en la lista de procesos e imprimir sus ID de proceso. <tty>
es el nombre del terminal, <pattern>
es el nombre del proceso o la palabra clave a buscar. Debe reemplazar estos parámetros según su situación real.
Ejemplo
root@ubuntu:~#
root@ubuntu:~# tty
/dev/pts/0
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# pgrep -t /dev/pts/0 bash
root@ubuntu:~#
root@ubuntu:~# pgrep -t /dev/pts/0 sy
root@ubuntu:~#
root@ubuntu:~# pgrep -t /dev/pts/0
root@ubuntu:~#
root@ubuntu:~# pgrep -t "/dev/pts/0"
root@ubuntu:~#
root@ubuntu:~# pgrep -t "/dev/pts/0" bash
root@ubuntu:~#
root@ubuntu:~#
Vergonzoso, no puedo encontrar nada en esta búsqueda.
10. Coincidencia por identificación válida (-u)
usar
pgrep -u <ID> <pattern>
Los comandos y pgrep --euid <ID> <pattern>
se utilizan para encontrar procesos coincidentes bajo el ID de usuario especificado o el ID de usuario efectivo.
<ID>
Los parámetros especifican una ID de usuario o una ID de usuario válida. Puede sustituir el nombre de usuario o el ID de usuario del usuario<ID>
.<pattern>
Los parámetros se utilizan para especificar el nombre del proceso o la palabra clave a buscar.
Orden
pgrep -u <ID> <pattern>
pgrep --euid <ID> <pattern>
Pasos de prueba
- Abra una terminal.
- Ejecute
id
el comando para obtener el ID de usuario y el ID de usuario efectivo del usuario actual. Por ejemplo, si el ID de usuario es1000
y el ID de usuario efectivo es1000
,<ID>
sustitúyalo por1000
. - Ejecute
pgrep -u <ID> <pattern>
el comando y<pattern>
reemplácelo con el nombre del proceso o la palabra clave que desea encontrar. Por ejemplo, si desea encontrar todos losbash
procesos en ejecución bajo el usuario actual, puede ejecutarpgrep -u 1000 bash
. - Si el comando se ejecuta correctamente, generará el ID del proceso coincidente.
- También puedes intentar ejecutar
pgrep --euid <ID> <pattern>
el comando, que hace lo mismo que el comando anterior.
Tenga en cuenta que pgrep
el comando se utiliza para buscar procesos coincidentes en la lista de procesos e imprimir sus ID de proceso. -u
La opción o --euid
se utiliza para especificar una ID de usuario o una ID de usuario válida. <ID>
es el ID de usuario o ID de usuario efectivo, <pattern>
es el nombre del proceso o la palabra clave que se encontrará. Debe reemplazar estos parámetros según su situación real.
Ejemplo
root@ubuntu:~#
root@ubuntu:~# id
uid=0(root) gid=0(root) groups=0(root)
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# pgrep -u 0000 bash
3058
3955
23187
root@ubuntu:~#
root@ubuntu:~# pgrep -u 0 bash
3058
3955
23187
root@ubuntu:~#
root@ubuntu:~# pgrep -u 1000 bash
root@ubuntu:~#
root@ubuntu:~# ps -ef | grep bash
root 1061 1 0 19:27 ? 00:00:00 /bin/bash /etc/systemd/nvmemwarning.sh
root 1260 1 0 19:28 ? 00:00:00 /bin/bash /ky/boot/kyai_nv_server.sh
root 1276 1 0 19:28 ? 00:00:00 /bin/bash /etc/systemd/nvgetty.sh
root 3058 2914 0 19:28 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 3955 3915 0 19:28 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 23187 23106 0 21:46 pts/0 00:00:00 -bash
root 36607 23187 0 23:39 pts/0 00:00:00 grep --color=auto bash
root@ubuntu:~#
root@ubuntu:~#
11. Coincidencia por ID real (-U)
Para obtener más información, consulte la identificación efectiva y la identificación real. Todavía no lo entiendo muy bien.
Orden
pgrep -U <ID> <pattern>
pgrep --uid <ID> <pattern>
Ejemplo
root@ubuntu:~#
root@ubuntu:~# pgrep -U 0000 bash
3058
3955
23187
root@ubuntu:~#
root@ubuntu:~#
12. Coincide exactamente con el nombre del comando (-x) ★★★
Orden
pgrep -x <pattern>
pgrep --exact <pattern>
Ejemplo
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 19:28 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 8 1 0 19:28 pts/0 00:00:39 ./kyai_rest
root 41 0 0 23:45 pts/1 00:00:00 /bin/bash
root 54 41 0 23:46 pts/1 00:00:00 ps -ef
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x kyai
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x kyai_rest
8
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f ./kyai_rest
8
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x bash
1
41
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f /bin/bash
41
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f /bin/bash /usr/local/bin/entrypoint.sh
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f "/bin/bash /usr/local/bin/entrypoint.sh"
1
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
Nota: Las coincidencias exactas son todas las coincidencias completas, incluidos los parámetros.