-
Notifications
You must be signed in to change notification settings - Fork 8
/
ledcontrol.initd
executable file
·55 lines (49 loc) · 1.6 KB
/
ledcontrol.initd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# System startup script for Klipper 3d-printer host code
### BEGIN INIT INFO
# Provides: ledcontrol
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Klipper daemon
# Description: Starts the LED control daemon.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DESC="ledcontrol daemon"
NAME="ledcontrol"
DEFAULTS_FILE=/etc/default/ledcontrol
PIDFILE=/var/run/ledcontrol.pid
. /lib/lsb/init-functions
# Read defaults file
[ -r $DEFAULTS_FILE ] && . $DEFAULTS_FILE
case "$1" in
start) log_daemon_msg "Starting ledcontrol" $NAME
start-stop-daemon --start --quiet --exec $LEDCONTROL_EXEC \
--background --pidfile $PIDFILE --make-pidfile \
--chuid $LEDCONTROL_USER --user $LEDCONTROL_USER \
-- $LEDCONTROL_ARGS
log_end_msg $?
;;
stop) log_daemon_msg "Stopping ledcontrol" $NAME
killproc -p $PIDFILE $KLIPPY_EXEC
RETVAL=$?
[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
log_end_msg $RETVAL
;;
restart) log_daemon_msg "Restarting ledcontrol" $NAME
$0 stop
$0 start
;;
reload|force-reload)
log_daemon_msg "Reloading configuration not supported" $NAME
log_end_msg 1
;;
status)
status_of_proc -p $PIDFILE $LEDCONTROL_EXEC $NAME && exit 0 || exit $?
;;
*) log_action_msg "Usage: /etc/init.d/ledcontrol {start|stop|status|restart|reload|force-reload}"
exit 2
;;
esac
exit 0