Skip to content

Run as nobody on redhat-based systems #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions init/pystatsd.init
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion pystatsd/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down