Linux shell脚本之判断进程是否在运行

时间:2021-04-13 16:54:33   收藏:0   阅读:38

vi proc1.sh
#!/bin/bash

#此脚本期望的参数个数
argno=1

if [ $# -ne $argno ]
then
echo "Usage: ‘basename $0‘ PID-number" >&2
fi

if [ ! -f "/proc/$1" ]
then
echo "Process #$1 is running"
else
echo "No such process running! "
fi

 

./proc1.sh 5728
Process #5728 is running

原文:https://www.cnblogs.com/zhudaheng123/p/14653245.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!