case编写的httpd简单启停脚本

时间:2022-04-05 19:24:20

case编写的httpd简单启停脚本

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