检查某一服务是否正常运行,执行脚本的时候第一个参数为服务名
#!/bin/bash result=$(pidof $1 | wc -l) echo ${result} if [ ${result} -eq 0 ] then echo "service does not exist !" else echo "Service is running normally !" fi