diff --git a/init/pystatsd.init b/init/pystatsd.init index 19fd4af..bb9d4a5 100755 --- a/init/pystatsd.init +++ b/init/pystatsd.init @@ -2,7 +2,7 @@ # # pystatsd This shell script takes care of starting and stopping pystatsd. # -# chkconfig: 2345 80 30 +# chkconfig: - 80 30 # description: Pystatsd is a front end/proxy for the Graphite stats collection and graphing server. # # processname: pystatsd @@ -13,8 +13,6 @@ # Provides: pystatsd # Required-Start: $local_fs $network # Required-Stop: $local_fs $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 # Short-Description: start and stop pystatsd # Description: Pystatsd is a front end/proxy for the Graphite stats collection and graphing server. ### END INIT INFO @@ -50,7 +48,8 @@ start() { # Start daemons. ret=0 echo -n $"Starting $prog: " - daemon /usr/bin/pystatsd-server --port $LOCAL_PYSTATD_PORT --pct $PCT --flush-interval $FLUSH_INTERVAL --counters-prefix $COUNTERS_PREFIX --timers-prefix $TIMERS_PREFIX --graphite-host $GRAPHITE_HOST --graphite-port $GRAPHITE_PORT --daemon --pidfile $PIDFILE + install -o $USER /dev/null $PIDFILE + daemon --user $USER /usr/bin/pystatsd-server --port $LOCAL_PYSTATD_PORT --pct $PCT --flush-interval $FLUSH_INTERVAL --counters-prefix $COUNTERS_PREFIX --timers-prefix $TIMERS_PREFIX --graphite-host $GRAPHITE_HOST --graphite-port $GRAPHITE_PORT --daemon --pidfile $PIDFILE RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pystatsd diff --git a/pystatsd/daemon.py b/pystatsd/daemon.py index 0b5156e..64bd34f 100644 --- a/pystatsd/daemon.py +++ b/pystatsd/daemon.py @@ -70,7 +70,10 @@ def start(self, *args, **kw): pid = None if os.path.exists(self.pidfile): with open(self.pidfile, 'r') as fp: - pid = int(fp.read().strip()) + try: + pid = int(fp.read().strip()) + except ValueError: + pass if pid: msg = 'pidfile (%s) exists. Daemon already running?\n'