首页 > 系统服务 > 详细

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

时间:2021-04-13 16:54:33      阅读:33      评论:0      收藏:0      [点我收藏+]

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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!