shell检查服务是否启动

来源:互联网 发布:淘宝前十女装店 编辑:程序博客网 时间:2024/05/17 21:50
#!/bin/bash      2 #check the httpd service is run      3 #参数检验      4 for i in "$@";      5 do      6         #echo $i;      7         #echo "item is ($item)";      8         www=`/usr/bin/pgrep $i`;      9         if [ "$www" != "" ];     10         then     11                 echo "the $i service is run ";     12         else     13                 echo "the $i service is stop ";     14         fi     15      16 done