Add systemd unit file

This commit is contained in:
Chris Elsworth 2020-04-21 20:32:59 +01:00
parent 0239214ea4
commit ad19153739
2 changed files with 21 additions and 1 deletions

View File

@ -82,7 +82,15 @@ screen
./server.rb
```
A systemd unit file will be added at some point so it starts automatically on boot.
Alternatively, you can use the provided systemd unit file. The instructions below will start it immediately, and then automatically on reboot. You'll need to be root to do these steps:
```
cp systemd/octolux_server.service /etc/systemd/system
systemctl start octolux_server.service
systemctl enable octolux_server.service
```
The logs can then be seen with `journalctl -u octolux_server.service`.
### octolux.rb

View File

@ -0,0 +1,12 @@
[Unit]
Description=Octolux Server
[Service]
User=pi
Restart=always
RestartSec=5
WorkingDirectory=/home/pi/octolux
ExecStart=/home/pi/octolux/server.rb
[Install]
WantedBy=default.target