From ce4b594f65cc448d5b7dc0df4de64a17ba70f651 Mon Sep 17 00:00:00 2001 From: James Vasile Date: Fri, 16 Dec 2011 20:54:01 -0500 Subject: daemonize --- share/init.d/plinth | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 share/init.d/plinth (limited to 'share') 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 -- cgit v1.2.3