mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
69 lines
1.5 KiB
Bash
Executable File
69 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
### BEGIN INIT INFO
|
|
# Provides: plinth
|
|
# Required-Start: $network $remote_fs $syslog
|
|
# Required-Stop: $remote_fs $syslog
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: plinth web frontend
|
|
# Description:
|
|
# Control the plinth web frontend.
|
|
### END INIT INFO
|
|
|
|
# This file is /etc/init.d/plinth
|
|
DAEMON=/usr/local/bin/plinth.py
|
|
PID_FILE=/var/run/plinth.pid
|
|
|
|
PLINTH_USER=www-data
|
|
PLINTH_GROUP=www-data
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
set -e
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
start_plinth (){
|
|
if [ -f $PID_FILE ]; then
|
|
echo Already running with a pid of `cat $PID_FILE`.
|
|
else
|
|
touch $PID_FILE
|
|
chown $PLINTH_USER:$PLINTH_GROUP $PID_FILE
|
|
sudo -u $PLINTH_USER -g $PLINTH_GROUP $DAEMON --pidfile=$PID_FILE
|
|
fi
|
|
}
|
|
|
|
stop_plinth () {
|
|
if [ -f $PID_FILE ]; then
|
|
kill -15 `cat $PID_FILE` || true
|
|
rm -rf $PID_FILE
|
|
echo "killed plinth"
|
|
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|force-reload)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
status)
|
|
status_of_proc -p $PID_FILE "$DAEMON" plinth && exit 0 || exit $?
|
|
;;
|
|
*)
|
|
echo "Usage: $NAME {start|stop|restart|force-reload|status}" >&2
|
|
exit 1
|
|
;;
|
|
|
|
esac
|