1

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?

3

Solved by adding these to service:

[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/pi/.Xauthority"

[Install]
WantedBy=graphical.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.