-
Notifications
You must be signed in to change notification settings - Fork 1
/
httpd.sh
39 lines (37 loc) · 1.05 KB
/
httpd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
NAME="httpd"
DESC="Web server"
DAEMON=/usr/local/sbin/busybox-httpd
OPTIONS="-h /home/tc/www"
case "$1" in
start)
echo "Starting $DESC: $NAME..."
start-stop-daemon --start --quiet -b --exec $DAEMON -- $OPTIONS
;;
stop)
echo "Stopping $DESC: $NAME..."
start-stop-daemon --stop --quiet --exec $DAEMON
;;
restart)
echo "Restarting $DESC..."
start-stop-daemon --stop --quiet --exec $DAEMON
sleep 3
start-stop-daemon --start --quiet -b --exec $DAEMON -- $OPTIONS
;;
force)
echo "Trying to force a restart of $NAME..."
ps -ef | grep httpd | grep -v grep | awk '{ print $1 }' | xargs kill -9
sleep 5
start-stop-daemon --start --quiet -b --exec $DAEMON -- $OPTIONS
;;
status)
ps -ef | grep $DAEMON | grep -v grep | awk '{ print $0 }'
;;
*)
echo ""
echo -e "Usage: /usr/local/etc/init.d/`basename $0` [start|stop|restart|force|status]"
echo ""
exit 1
;;
esac
exit 0