diff options
author | James Vasile <james@hackervisions.org> | 2011-12-16 20:54:01 -0500 |
---|---|---|
committer | James Vasile <james@jamesvasile.com> | 2012-02-19 15:07:14 -0500 |
commit | ce4b594f65cc448d5b7dc0df4de64a17ba70f651 (patch) | |
tree | ae30a7f85f229501ca3957d257aff40b081fa983 /share/init.d | |
parent | d3a2fbc05e3d61c77c25fd7b0b3701e9f34f3395 (diff) |
daemonize
Diffstat (limited to 'share/init.d')
-rwxr-xr-x | share/init.d/plinth | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/share/init.d/plinth b/share/init.d/plinth new file mode 100755 index 0000000..f5df9b7 --- /dev/null +++ b/share/init.d/plinth @@ -0,0 +1,38 @@ +#!/bin/bash +# This file is /etc/init.d/plinth +DAEMON=/usr/bin/plinth.py +PID_FILE=/var/run/plinth.pid + +start_plinth (){ + if [ -f $PID_FILE ]; then + echo Already running with a pid of `cat $PID_FILE`. + else + $DAEMON --pidfile=$PID_FILE + fi +} + +stop_plinth () { + if [ -f $PID_FILE ]; then + kill -15 `cat $PID_FILE` + rm -rf $PID_FILE + else + echo "No pid file at $PID_FILE suggests plinth is not running." + fi +} + +test -x $DAEMON || exit 0 +case "$1" in + start) + echo "Starting Plinth." + start_plinth + ;; + stop) + echo "Stoping Plinth." + stop_plinth + ;; + restart) + $0 stop + $0 start + ;; + +esac |