2015-01-01 16:19:41 +01:00

61 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
### BEGIN INIT INFO
# Provides: pveproxy
# Required-Start: $remote_fs $network $syslog pvedaemon
# Required-Stop: $remote_fs $network $syslog pvedaemon
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PVE API Proxy Server
### END INIT INFO
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/bin:/usr/sbin
DAEMON=/usr/bin/pveproxy
NAME=pveproxy
DESC="PVE API Proxy Server"
RUNDIR=/var/run/pveproxy
PIDFILE=${RUNDIR}/pveproxy.pid
test -f $DAEMON || exit 0
# avoid warnings about uninstalled locales when pveproxy executes commands
export LC_ALL="C"
mkdir -p ${RUNDIR} || true
chmod 0700 ${RUNDIR} || true
chown www-data:www-data ${RUNDIR} || true
DAEMON_OPTS=""
# Include defaults if available
if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
$DAEMON start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
$DAEMON stop
log_end_msg $?
;;
restart|reload|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
$DAEMON restart
log_end_msg $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0