adding systemd service script and a script to install it as a service that runs during startup

pull/1/head
jbruce12000 2018-11-26 21:15:24 -05:00
rodzic e8bf698212
commit 624ae9e739
3 zmienionych plików z 11 dodań i 32 usunięć

Wyświetl plik

@ -1,32 +0,0 @@
### BEGIN INIT INFO
# Provides: Start kiln-controller server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start kiln-controller Server
# Description: picoFlow On Raspberry Pi
### END INIT INFO
#! /bin/sh
# /etc/init.d/kiln-controller
export HOME
case "$1" in
start)
echo "Starting kiln-controller Server"
/home/pi/kiln-controller/venv/bin/python /home/pi/kiln-controller/kiln-controller.py 2>&1 &
;;
stop)
echo "Stopping kiln-controller Server"
reflow_PID=`ps auxwww | grep kiln-controller.py | head -1 | awk '{print $2}'`
kill -9 $reflow_PID
;;
*)
echo "Usage: /etc/init.d/kiln-controller {start|stop}"
exit 1
;;
esac
exit 0

Wyświetl plik

@ -0,0 +1,8 @@
[Unit]
Description=kiln-controller
[Service]
ExecStart=/home/pi/kiln-controller/venv/bin/python /home/pi/kiln-controller/kiln-controller.py
[Install]
WantedBy=multi-user.target

3
start-on-boot 100755
Wyświetl plik

@ -0,0 +1,3 @@
#!/bin/bash
sudo cp /home/pi/kiln-controller/lib/init/kiln-controller.service /etc/systemd/system/
sudo systemctl enable kiln-controller