检测某个进程是否存在

检测某个进程是否存在

参数输入进程号...
#!/bin/bash

    if [ -z $1 ]
    then
        echo "Need a pid argument"
        exit 1
    fi

    if [ -d /proc/$1 ];then
        exit 0
    else
        exit 1
    fi

你可能感兴趣的:(检测某个进程是否存在)