-
Notifications
You must be signed in to change notification settings - Fork 25
Running As Service
paddywwoof edited this page Mar 14, 2021
·
11 revisions
The example shows how to run PictureFrame as systemd user service on a pi3.
mkdir ~/.config/systemd/user/ -p
nano ~/.config/systemd/user/picframe.service
[Unit]
Description=PictureFrame on Pi3
[Service]
ExecStart=/home/pi/.local/bin/picframe ~/picframe_data/config/configuration.yaml
Restart=always
[Install]
WantedBy=default.target
You have the following options:
- Enable service
systemctl --user enable picframe.service
- Disable service
systemctl --user disable picframe.servcie
- Start service
systemctl --user start picframe.service
- Stop service
systemctl --user stop picframe.service
- Stop restart
systemctl --user restart picframe.service
- Check logfiles
journalctl --user-unit picframe.service
This works for autlogin to console or GUI.
If you want to start PictureFrame without autologin use
loginctl enable-linger pi
. Assuming 'pi' is your username. To disable it run loginctl disable-linger pi
sudo nano /etc/systemd/system/picframe.service
[Unit]
Description=Pi3D on Pi4
After=multi-user.target
[Service]
Type=idle
User=root
ExecStart=xinit /usr/bin/python3 /home/pi/picframe_data/run_start.py /home/pi/picframe_data/config/configuration.yaml
#Restart=always
[Install]
WantedBy=multi-user.target
You have the following options:
- Enable service
sudo systemctl enable picframe.service
- Disable service
sudo systemctl disable picframe.servcie
- Start service
sudo systemctl start picframe.service
- Stop service
sudo systemctl stop picframe.service
- Stop restart
sudo systemctl restart picframe.service
- Check logfiles
sudo journalctl picframe.service
For Pi 4 the service needs to be controlled by root e. g. sudo systemctl enable picframe.service
etc