diff options
author | Daniel de Kok <danieldk@pobox.com> | 2010-05-11 19:45:54 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-11 19:45:54 +0200 |
commit | 2e4da0964a8e9a99181261911874cef506d050ac (patch) | |
tree | 8074a3488609ec8556a12250060b894cae799532 /network/lighttpd/rc.lighttpd | |
parent | 636c1c24830e3370110ce101e5914e00fe4ec4ca (diff) | |
download | slackbuilds-2e4da0964a8e9a99181261911874cef506d050ac.tar.gz |
network/lighttpd: Updated for version 1.4.18
Diffstat (limited to 'network/lighttpd/rc.lighttpd')
-rw-r--r-- | network/lighttpd/rc.lighttpd | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/network/lighttpd/rc.lighttpd b/network/lighttpd/rc.lighttpd index cb180c3e88..2f31a40e69 100644 --- a/network/lighttpd/rc.lighttpd +++ b/network/lighttpd/rc.lighttpd @@ -1,6 +1,5 @@ #!/bin/sh # Copyright (c) 2007, Daniel de Kok <moc.mikciat@leinad> -# Modified by Martin Lefebvre <dadexter@sekurity.com> # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -25,11 +24,15 @@ LIGHTTPD=/usr/sbin/lighttpd PIDFILE=/var/run/lighttpd.pid LIGHTTPD_OPTIONS="-f /etc/lighttpd/lighttpd.conf" +is_pidof() { + local STATE=$(ps -p $1 -o cmd= | grep "$2" > /dev/null ; echo $?) + return $STATE +} + lighttpd_start() { echo "Starting lighttpd: $LIGHTTPD" - if [ -r $PIDFILE ]; then - echo "Already running or stale PID file" - echo "If it's not running, remove $PIDFILE" + if [ -r $PIDFILE ] && is_pidof $(cat $PIDFILE) lighttpd ; then + echo "Already running!" return fi $LIGHTTPD $LIGHTTPD_OPTIONS @@ -37,9 +40,11 @@ lighttpd_start() { lighttpd_stop() { echo "Stopping lighttpd: $LIGHTTPD" - if [ -r $PIDFILE ]; then - kill -3 `cat $PIDFILE` + if [ -r $PIDFILE ] && is_pidof $(cat $PIDFILE) lighttpd ; then + kill $(cat $PIDFILE) rm -f $PIDFILE + else + echo "Not running!" fi } |