Permalink
Browse files

Add a basic set of files to start BeagleG with systemd

  • Loading branch information...
hzeller committed Jun 15, 2018
1 parent bd355b8 commit a83c76166aa92641ae57d11df0546390f3fc0a1e
Showing with 58 additions and 0 deletions.
  1. +4 −0 systemd/Makefile
  2. +12 −0 systemd/README
  3. +10 −0 systemd/beagleg.service
  4. +32 −0 systemd/run-beagleg.sh
@@ -0,0 +1,4 @@
PREFIX?=/usr/local
install:
install beagleg.service /etc/systemd/system/
install run-beagleg.sh $(PREFIX)/bin
@@ -0,0 +1,12 @@
Support to start BeagleG using systemd.
Just modify according to your taste, then
sudo make install
Copy your configuration file to /etc/beagleg.config
Pretty basic right now; Questions (as I am more comfortable with SysV init:)
* is it an ok practice to have a start script like run-beagleg.sh which then is
called from systemd ?
* What is the recommended service to depend on so that the uio_pruss module
is properly loaded ? Right now this is happening manually.
@@ -0,0 +1,10 @@
[Unit]
Description=BeagleG - CNC motion control
[Service]
User=root
ExecStart=/usr/local/bin/run-beagleg.sh
[Install]
WantedBy=basic.target
@@ -0,0 +1,32 @@
#!/bin/bash
# Dropping permisisons to this after hardware is initialized
PERMISSION_DROP=daemon:daemon
VARDIR=/var/beagleg
mkdir -p $VARDIR
chown $PERMISSION_DROP $VARDIR
# The port we're listening for gcode commands.
PORT=4444
# Status server port.
STATUS_PORT=4445
# Machine configuration of motors and switches etc.
CONFIG=/etc/beagleg.config
# Permanent storage of variables used in GCode
PARAMS_FILE=$VARDIR/beagleg.params
# Logfile
LOGFILE=$VARDIR/beagleg.log
# Machine control binary. Default 'make install' location is in /usr/local/bin
MACHINE_CONTROL=/usr/local/bin/machine-control
# We do need the uio-pruss module to be loaded.
# TODO: figure out what in systemd the preferred 'After' target is to
# have his already taken care of.
modprobe uio_pruss
exec ${MACHINE_CONTROL} --priv=${PERMISSION_DROP} --config=${CONFIG} --port=${PORT} --status-server=${STATUS_PORT} --logfile=${LOGFILE} --param=${PARAMS_FILE}

0 comments on commit a83c761

Please sign in to comment.