I tried with systemctl and with crontab without success.
here is the script:
#!/bin/bash
cyberghostvpn --country-code AU --city Brisbane --connect
rights :
-rwxr-xr-x 1 pat pat 71 nov 28 13:04 ghoststart.sh
my crontab that i have run this way : sudo crontab -e
@reboot sleep 120; /home/pat/Documents/cyberghost/ghoststart.sh
i can run the script in terminal no problem : sudo sh ghoststart.sh
syslog cron :
Nov 28 13:17:57 mrpotato cron[679]: (CRON) INFO (pidfile fd = 3)
Nov 28 13:17:57 mrpotato cron[679]: (CRON) INFO (Running @reboot jobs)
Nov 28 13:17:59 mrpotato CRON[726]: (root) CMD (sh /home/pat/Documents/cyberghost/ghoststart.sh)
Nov 28 13:24:04 mrpotato cron[658]: (CRON) INFO (pidfile fd = 3)
Nov 28 13:24:04 mrpotato cron[658]: (CRON) INFO (Running @reboot jobs)
seems like cron stopped working after 13:24:04, beacause ive done attempt after that
edit 2: based on this i have tried
root@mrpotato:/var/spool/cron/crontabs# /bin/sh -c "(export PATH=/usr/bin:/bin; /home/pat/Documents/cyberghost/ghoststart.sh </dev/null)"
Prepare OpenVPN connection ...
Please Install "openvpn" first!
it gives me the same error if i wasnt root, obviouly openvpn is installed
3rd edit:
if i do this i get no error .
pat@mrpotato:~$ sudo /bin/sh -c "(export PATH=/usr/bin:/bin; /home/pat/Documents/cyberghost/ghoststart.sh </dev/null)"
but if i do this i get one:
root@mrpotato:~# /bin/sh -c "(export PATH=/usr/bin:/bin; /home/pat/Documents/cyberghost/ghoststart.sh </dev/null)"
the error is :
Traceback (most recent call last):
File "cyberghostvpn.py", line 580, in <module>
File "cyberghostvpn.py", line 346, in main
File "libs/config.py", line 45, in __init__
File "libs/config.py", line 112, in readConfigFile
Exception: The config file "/home/root/.cyberghost/config.ini" does not exist!
[3845] Failed to execute script cyberghostvpn
config.ini exist in /home/pat/.cyberghost/
cron must be running the script as root and not with sudo... or something like that, the script gets the file from the running user... if that make sense.
i have no idea how to solve that !