case编写的httpd简单启停脚本

                       case编写的httpd简单启停脚本                      

#!/bin/bash
HTTPD="/etc/init.d/httpd"
. /etc/init.d/functions
case "$1" in
        start)
                $HTTPD start >& /dev/null
                [ $? -eq 0 ] && action "httpd is startd" /bin/true ||\
                action "httpd is startd"/bin/false
;;
        stop)
                $HTTPD stop >& /dev/null
                [ $? -eq 0 ] && action "httpd is stopd" /bin/true ||\
                action "httpd is stopd"/bin/false
;;
        restart)
                $HTTPD restart >& /dev/null
                [ $? -eq 0 ] && action "httpd is restartd" /bin/true ||\
                action "httpd is restartd"/bin/false
;;
        *)
                echo "$0 Usage {start stop restart}"
esac

 

posted @ 2016-04-21 18:37  唐胜伟  阅读(377)  评论(0编辑  收藏  举报