adding systemd service script and a script to install it as a service that runs during startup
This commit is contained in:
parent
e8bf698212
commit
624ae9e739
@ -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
|
|
||||||
8
lib/init/kiln-controller.service
Normal file
8
lib/init/kiln-controller.service
Normal file
@ -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
Executable file
3
start-on-boot
Executable file
@ -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
|
||||||
Loading…
Reference in New Issue
Block a user