forked from OctoPrint/OctoPrint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
octoprint.init
executable file
·49 lines (40 loc) · 1.05 KB
/
octoprint.init
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
#!/bin/sh
#
# Copy this script to /etc/init.d/octoprint and adjust the variables
# at the top to match your installation (should be okay for a Raspian
# setup). Then link it to the correct run levels. On Debian/Rasbian
# just call 'sudo update-rc.d octoprint defaults'
### BEGIN INIT INFO
# Provides: octoprint
# Required-Start: $local_fs networking
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Run octoprint
# Description: Octoprint provides a responsive web interface for
# controlling a 3D printer
### END INIT INFO
# OctoPrint's run script
DAEMON=/home/pi/OctoPrint/run
# Port to use
PORT=5000
# Run as this user
RUNAS=pi
# Exit if the run script is not found
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
su $RUNAS -c "$DAEMON --port=$PORT --daemon start"
;;
stop)
su $RUNAS -c "$DAEMON --port=$PORT --daemon stop"
;;
restart)
su $RUNAS -c "$DAEMON --port=$PORT --daemon restart"
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
;;
esac
: