|
Lines 128-133
Link Here
|
| 128 |
# Read config |
128 |
# Read config |
| 129 |
. $LIGHTTPD_CONFIG |
129 |
. $LIGHTTPD_CONFIG |
| 130 |
|
130 |
|
|
|
131 |
# Parse configs to determine the pid file. Yuck. |
| 132 |
ACTUAL_CONFIG="${LIGHTTPD_PARAMS##*-f }" |
| 133 |
ACTUAL_CONFIG="${ACTUAL_CONFIG%% *}" |
| 134 |
# echo "=$ACTUAL_CONFIG=" |
| 135 |
|
| 136 |
get_var() { |
| 137 |
sed -n "/$1/s/^[^\"]*\"//;T;s/\".*//;p;q" $2 |
| 138 |
} |
| 139 |
|
| 140 |
S="[[:space:]]*" |
| 141 |
STATE_DIR=`get_var "^var.state_dir${S}=${S}" $ACTUAL_CONFIG` |
| 142 |
PID_FILE_BASE=`get_var "^server.pid-file${S}=${S}state_dir${S}+${S}" $ACTUAL_CONFIG` |
| 143 |
|
| 144 |
# typically /var/run/lighttpd.pid |
| 145 |
PID_FILE=${STATE_DIR}${PID_FILE_BASE} |
| 146 |
# echo "=$PID_FILE=" |
| 147 |
|
| 131 |
# Source LSB init functions |
148 |
# Source LSB init functions |
| 132 |
# providing start_daemon, killproc, pidofproc, |
149 |
# providing start_daemon, killproc, pidofproc, |
| 133 |
# log_success_msg, log_failure_msg and log_warning_msg. |
150 |
# log_success_msg, log_failure_msg and log_warning_msg. |
|
Lines 175-181
Link Here
|
| 175 |
## Start daemon with startproc(8). If this fails |
192 |
## Start daemon with startproc(8). If this fails |
| 176 |
## the return value is set appropriately by startproc. |
193 |
## the return value is set appropriately by startproc. |
| 177 |
umask ${LIGHTTPD_UMASK:-077} |
194 |
umask ${LIGHTTPD_UMASK:-077} |
| 178 |
startproc -e $LIGHTTPD_BIN $LIGHTTPD_PARAMS |
195 |
startproc -p $PID_FILE -e $LIGHTTPD_BIN $LIGHTTPD_PARAMS |
| 179 |
|
196 |
|
| 180 |
# Remember status and be verbose |
197 |
# Remember status and be verbose |
| 181 |
rc_status -v |
198 |
rc_status -v |
|
Lines 185-191
Link Here
|
| 185 |
## Stop daemon with killproc(8) and if this fails |
202 |
## Stop daemon with killproc(8) and if this fails |
| 186 |
## killproc sets the return value according to LSB. |
203 |
## killproc sets the return value according to LSB. |
| 187 |
|
204 |
|
| 188 |
killproc -TERM $LIGHTTPD_BIN |
205 |
killproc -TERM -p $PID_FILE $LIGHTTPD_BIN |
| 189 |
|
206 |
|
| 190 |
# Remember status and be verbose |
207 |
# Remember status and be verbose |
| 191 |
rc_status -v |
208 |
rc_status -v |
|
Lines 222-228
Link Here
|
| 222 |
|
239 |
|
| 223 |
echo -n "Reload service lighttpd " |
240 |
echo -n "Reload service lighttpd " |
| 224 |
## if it supports it: |
241 |
## if it supports it: |
| 225 |
killproc -HUP $LIGHTTPD_BIN |
242 |
killproc -HUP -p $PID_FILE $LIGHTTPD_BIN |
| 226 |
#touch /var/run/lighttpd.pid |
243 |
#touch /var/run/lighttpd.pid |
| 227 |
rc_status -v |
244 |
rc_status -v |
| 228 |
|
245 |
|
|
Lines 236-242
Link Here
|
| 236 |
|
253 |
|
| 237 |
# If it supports signaling: |
254 |
# If it supports signaling: |
| 238 |
echo -n "Reload service lighttpd " |
255 |
echo -n "Reload service lighttpd " |
| 239 |
killproc -HUP $LIGHTTPD_BIN |
256 |
killproc -HUP -p $PID_FILE $LIGHTTPD_BIN |
| 240 |
#touch /var/run/lighttpd.pid |
257 |
#touch /var/run/lighttpd.pid |
| 241 |
rc_status -v |
258 |
rc_status -v |
| 242 |
|
259 |
|
|
Lines 258-264
Link Here
|
| 258 |
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) |
275 |
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) |
| 259 |
|
276 |
|
| 260 |
# NOTE: checkproc returns LSB compliant status values. |
277 |
# NOTE: checkproc returns LSB compliant status values. |
| 261 |
checkproc $LIGHTTPD_BIN |
278 |
checkproc -k -p $PID_FILE $LIGHTTPD_BIN |
| 262 |
# NOTE: rc_status knows that we called this init script with |
279 |
# NOTE: rc_status knows that we called this init script with |
| 263 |
# "status" option and adapts its messages accordingly. |
280 |
# "status" option and adapts its messages accordingly. |
| 264 |
rc_status -v |
281 |
rc_status -v |
|
Lines 268-274
Link Here
|
| 268 |
## argument to this init script which is required for a reload. |
285 |
## argument to this init script which is required for a reload. |
| 269 |
## Note: probe is not (yet) part of LSB (as of 1.9) |
286 |
## Note: probe is not (yet) part of LSB (as of 1.9) |
| 270 |
|
287 |
|
| 271 |
test /etc/lighttpd/lighttpd.conf -nt /var/run/lighttpd.pid && echo reload |
288 |
test /etc/lighttpd/lighttpd.conf -nt $PID_FILE && echo reload |
| 272 |
;; |
289 |
;; |
| 273 |
*) |
290 |
*) |
| 274 |
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" |
291 |
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" |