mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 16:51:12 -07:00
Add the gfcloud full-cloud controller daemon
gfcloud runs the machine under the Glowforge web service (the factory cloud experience: the app drives homing, framing, printing). Its init service starts it only when controller_mode = cloud - mutually exclusive with grblHAL, which already stands down for that mode - so it owns /dev/glowforge exclusively. Persistent GFUIService loop with a clean SIGTERM shutdown that safes the hardware; the init script mirrors grblhal.init. The image installs gfcloud and python3-ffmachine.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gfcloud
|
||||
# Required-Start: $local_fs $network
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Glowforge web-service controller (full cloud mode)
|
||||
### END INIT INFO
|
||||
|
||||
DAEMON=/usr/sbin/gfcloud.py
|
||||
PIDFILE=/var/run/gfcloud.pid
|
||||
CONF=/data/forgefirm.conf
|
||||
|
||||
# Boot-time controller-mode dispatch, mirror of grblhal.init: this daemon
|
||||
# runs the machine under the Glowforge web service. It starts only when
|
||||
# controller_mode = cloud (which keeps grblHAL down); anything else - grbl,
|
||||
# unset, or no config file - leaves it stopped.
|
||||
controller_mode() {
|
||||
[ -r $CONF ] || { echo grbl; return; }
|
||||
m=$(sed -n 's/^[ \t]*controller_mode[ \t]*=[ \t]*\([a-z]*\).*/\1/p' $CONF | tail -n 1)
|
||||
echo "${m:-grbl}"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "$(controller_mode)" != "cloud" ]; then
|
||||
echo "gfcloud not started (controller_mode != cloud)"
|
||||
exit 0
|
||||
fi
|
||||
echo "Starting gfcloud"
|
||||
start-stop-daemon -S -q -p $PIDFILE -m -b -x $DAEMON
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping gfcloud"
|
||||
start-stop-daemon -K -q -p $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
Reference in New Issue
Block a user