diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-04-20 12:30:15 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-04-21 10:14:27 -0400 |
commit | ec805aee2e1d1376f3f015116575369f44e5ad90 (patch) | |
tree | 88c3d43e5cffdfa6356b5396e1fa92ea0c9d371a /scripts/klipper-start.sh | |
parent | 167b18b58f919da314266a359353a0bf8e33861b (diff) | |
download | kutter-ec805aee2e1d1376f3f015116575369f44e5ad90.tar.gz kutter-ec805aee2e1d1376f3f015116575369f44e5ad90.tar.xz kutter-ec805aee2e1d1376f3f015116575369f44e5ad90.zip |
scripts: Add octopi installation scripts
Add a system startup script so that Klipper can automatically start at
boot time. Create an installation script that will install the system
dependencies and the startup script.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts/klipper-start.sh')
-rwxr-xr-x | scripts/klipper-start.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/klipper-start.sh b/scripts/klipper-start.sh new file mode 100755 index 00000000..53b19859 --- /dev/null +++ b/scripts/klipper-start.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# System startup script for Klipper 3d-printer host code + +### BEGIN INIT INFO +# Provides: klipper +# Required-Start: $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Klipper daemon +# Description: Starts the Klipper daemon. +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +DESC="klipper daemon" +NAME="klipper" +DEFAULTS_FILE=/etc/default/klipper +PIDFILE=/var/run/klipper.pid + +. /lib/lsb/init-functions + +# Read defaults file +[ -r $DEFAULTS_FILE ] && . $DEFAULTS_FILE + +case "$1" in +start) log_daemon_msg "Starting klipper" $NAME + start-stop-daemon --start --quiet --exec $KLIPPY_EXEC \ + --background --pidfile $PIDFILE --make-pidfile \ + --chuid $KLIPPY_USER --user $KLIPPY_USER \ + -- $KLIPPY_ARGS + log_end_msg $? + ;; +stop) log_daemon_msg "Stopping klipper" $NAME + killproc -p $PIDFILE $KLIPPY_EXEC + RETVAL=$? + [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE + log_end_msg $RETVAL + ;; +restart) log_daemon_msg "Restarting klipper" $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 $KLIPPY_EXEC $NAME && exit 0 || exit $? + ;; +*) log_action_msg "Usage: /etc/init.d/klipper {start|stop|status|restart|reload|force-reload}" + exit 2 + ;; +esac +exit 0 |