I'm trying to automate the connection of a VPN tunnel via cron upon system boot.
I have a bash-script triggered by roots cron sudo crontab -e
(because some other commands needs elevation).
I'd be fine using piactl (cli), but when trying to connect I get a message saying the client needs to be started, so...
One of the steps I'd like to perform is to start an GUI application (pia-client) on my non-root users display.
The following command works directly from terminal:
sudo su
runuser -l $username -c 'DISPLAY=:0 /opt/piavpn/bin/pia-client &> /dev/null &'
However, when I put that into my script is doesn't work.
The script is executable chmod +x /path/to/script.sh
and other commands in the same script is working.
Anyone have a solution here?