mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-06-01 04:40:36 +00:00
62 lines
1.6 KiB
Bash
Executable File
62 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: pvedaemon
|
|
# Required-Start: $remote_fs $network $syslog pve-cluster cman clvm
|
|
# Required-Stop: $remote_fs $network $syslog pve-cluster cman clvm
|
|
# X-Start-Before: apache2
|
|
# X-Stop-After: apache2
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: PVE Daemon
|
|
### END INIT INFO
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
PATH=/sbin:/bin:/usr/bin:/usr/sbin
|
|
DAEMON=/usr/bin/pvedaemon
|
|
NAME=pvedaemon
|
|
DESC="PVE Daemon"
|
|
PIDFILE=/var/run/pvedaemon.pid
|
|
|
|
test -f $DAEMON || exit 0
|
|
|
|
# avoid warnings about uninstalled locales when pvedaemon executes commands
|
|
export LC_ALL="C"
|
|
|
|
case "$1" in
|
|
start)
|
|
log_daemon_msg "Starting $DESC" "$NAME"
|
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
|
|
log_end_msg $?
|
|
;;
|
|
stop)
|
|
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
start-stop-daemon --stop --quiet --retry TERM/2/TERM/10/KILL/2 --pidfile $PIDFILE
|
|
log_end_msg $?
|
|
;;
|
|
reload)
|
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
|
if ( [ -e $PIDFILE ] && kill -0 `cat $PIDFILE`) then
|
|
start-stop-daemon --stop --signal HUP --pidfile $PIDFILE
|
|
else
|
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
|
|
fi
|
|
log_end_msg $?
|
|
;;
|
|
restart|force-reload)
|
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
|
start-stop-daemon --stop --quiet --retry TERM/2/TERM/10/KILL/2 --pidfile $PIDFILE
|
|
sleep 2
|
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
|
|
log_end_msg $?
|
|
;;
|
|
*)
|
|
N=/etc/init.d/$NAME
|
|
echo "Usage: $N {start|stop|restart|force-reload}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|