Systemd run script after GUI is ready?
I’m running raspbian on pi. I’ve created a systemd script which runs a node.js app on startup.
Script:
#!/usr/bin/env bash
cd /home/pi/pop_machine && /usr/bin/npm start
Systemd Service:
[Service]
ExecStart=/home/pi/pop_machine/start_pop.sh
[Install]
WantedBy=default.target
The script works if I run it manually but not on startup. I’m wondering if it’s because it tries to run before its dependencies.
I’ve seen people require networking before running by adding a line to [install]
is there something similar where I can wait until everything to run a GUI application is ready?
I assume I just need x-window?
Solved by adding these to service:
[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/pi/.Xauthority"
[Install]
WantedBy=graphical.target