mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
daemonize
This commit is contained in:
1 parent
d3a2fbc05e
commit
ce4b594f65
2 files changed
+60
-2
No files matched your search
Executable
+38
@@ -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
|
||||
Reference in new issue
Block a user