Scroll to navigation

PIDOF(8) Manual de Administrador de Sistema Linux PIDOF(8)

NOME

pidof - encontra o ID de processo de um programa a correr

RESUMO

pidof [-s] [-c] [-n] [-x] [-z] [-o omitpid[,omitpid...]] [-o omitpid[,omitpid...]...] [-d sep] program [program...]

DESCRIÇÃO

pidof finds the process id's (PIDs) of the named programs. It prints those id's on the standard output. This program is on some systems used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon(8) program that should be used instead.

OPÇÕES

Single shot - isto instruí o programa a apenas retornar um pid.
Apenas retorna PIDs de processos que estão a correr no mesmo directório raiz. Esta opção é ignorada para utilizadores não-root, pois seria incapaz de verificar o directório raiz actual dos processos que não possui.
Evita chamar a função de sistema stat(2) em todos os binários que estão localizados em sistemas de ficheiros baseados em rede como NFS. Em vez de usar esta opção a variável PIDOF_NETFS pode ser definida e exportada.
Do not display matched PIDs to standard out. Simply exit with a status of true or false to indicate whether a matching PID was found.
Scripts too - isto faz o programa também retornar id's de processos de shells que correm nos strings nomeados.
Try to detect processes which are stuck in zombie (Z) status. Usually these processes are skipped as trying to deal with them can cause pidof or related tools to hang. Note: In the past pidof would ignore processes in the uninterruptable state (D), unless the -z flag was specified. This is no longer the case. The pidof program will find and report processes in the D state whether -z is specified or not.
Tells pidof to use sep as an output separator if more than one PID is shown. The default separator is a space.
Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof program, in other words the calling shell or shell script.

ESTADO DE SAÍDA

0
Pelo menos um programa foi encontrado com o nome requisitado.
1
Nenhum programa foi encontrado com o nome requisitado.

NOTAS

pidof é na realidade o mesmo programa que killall5(8); o programa comporta-se de acordo com o nome pelo qual é chamado.

When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that it returns PIDs of running programs that happen to have the same name as the program you're after but are actually other programs. Note that the executable name of running processes is calculated with readlink(2), so symbolic links to executables will also match.

Os processos zombie ou processos em disco adormecido (estados Z e D, respetivamente) são ignorados, pois as tentativas de aceder às estatísticas destes irá algumas vezes falhar. A bandeira -z (veja em cima) diz ao pidof para tentar detectar estes processos adormecidos e zombie, com o risco de falhar ou ficar pendurado.

VEJA TAMBÉM

pidofproc(8), shutdown(8), init(8), halt(8), reboot(8), killall5(8)

AUTOR

Miquel van Smoorenburg

1 Setembro 1998 sysvinit