-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapache-init-helper
executable file
·120 lines (108 loc) · 2.44 KB
/
apache-init-helper
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
#
# /etc/rc.d/init.d/apache-minimal
#
# A simple apache httpd wrapper for docker-migrid container use
#
# Recognized arguments:
# start - start apache httpd
# stop - terminate apache httpd
# restart - terminate and start apache httpd
# reload - reload apache httpd
# status - report apache httpd status
#
# Customization of the httpd installation should be specified by
# variables in /etc/sysconfig/apache-minimal
#
# Made from the template /usr/share/doc/initscripts-X/sysinitvfiles
# from our CentOS installation
#
# <tags ...>
#
# chkconfig: - 90 10
# description: Apache httpd is a web server
# processname: httpd
# config: /etc/sysconfig/apache-minimal
#
# Source function library.
. /etc/init.d/functions
# <define any local shell functions used by the code that follows>
# first, pull in custom configuration (if it exists):
if [ -f /etc/sysconfig/apache-minimal ]; then
. /etc/sysconfig/apache-minimal
fi
# define default locations and user for MiG if not set:
if [ -z "$MIG_USER" ]; then
MIG_USER=mig
fi
if [ -z "$MIG_PATH" ]; then
MIG_PATH=/home/${MIG_USER}
fi
# more configurable paths:
if [ -z "$MIG_STATE" ]; then
MIG_STATE=${MIG_PATH}/state
fi
if [ -z "$MIG_CODE" ]; then
MIG_CODE=${MIG_PATH}/mig
fi
# Needed for absolute mig.X imports which are now required by PEP8
if [ -z "$PYTHONPATH" ]; then
export PYTHONPATH=${MIG_PATH}
else
export PYTHONPATH=${MIG_PATH}:$PYTHONPATH
fi
# you probably do not want to modify these...
PID_DIR="${PID_DIR:-/var/run}"
DAEMON_PATH="/usr/sbin/httpd"
PID_FILE="$PID_DIR/httpd/httpd.pid"
show_usage() {
echo "Usage: apache-minimal {start|stop|status|restart|reload}"
}
start_apache() {
echo -n "Starting apache httpd server"
${DAEMON_PATH} -k start
RET2=$?
[ $RET2 ] && success
echo
[ $RET2 ] || echo "Warning: httpd not started."
echo
}
stop_apache() {
echo -n "Shutting down apache httpd server"
killproc ${DAEMON_PATH}
echo
}
reload_apache() {
echo -n "Reloading apache httpd server"
killproc ${DAEMON_PATH} -HUP
echo
}
status_apache() {
status ${DAEMON_PATH}
}
### Main ###
# Exit cleanly if main daemon is missing
test -f ${DAEMON_PATH} || exit 0
case "$1" in
start)
start_apache
;;
stop)
stop_apache
;;
status)
status_apache
;;
restart)
stop_apache
start_apache
;;
reload)
reload_apache
;;
*)
show_usage
exit 1
;;
esac
exit $?