UNSOLVED Auto Execute Startup Scripts
Is there any commands or something that have to be run in the terminal for a script to start at boot? Scripts run fine using $ bash script.sh but when run through crontab, /etc/init.d/script, and the like to start at boot, the scripts don't function properly.
Flohack last edited by
@davedanger No because Ubuntu Touch is not like a desktop/server Linux distro. Its mainly centered around using Apps in a heavily confined environment. First of all you should not do anything that needs to make the rootfs writable. ITs readonly so it can be upgraded through imagebased delta upgrades.
Then, what exactly should this script achieve?
@flohack It's a vpn auto-connect script
@davedanger Can you share it here (at least its core)? Maybe someone can help you.
You can add upstart scripts in user space. Example: put into
description "run script local-init" start on started unity8 exec /home/phablet/local/bin/local-init
and add your commands into the file given in the
The script is:
while [ "true" ]
VPNCON=$(nmcli con status)
if [[ $VPNCON != MyVPNConnectionName ]]; then
echo "Disconnected, trying to reconnect..."
(sleep 1s && nmcli con up uuid df648abc-d8f7-4ce4-bdd6-3e12cdf0f494)
echo "Already connected !"
The UUID of your personal VPN can be found with: nmcli con
If I run this script in the terminal with bash script.sh or just copy/paste, it works great. My VPN toggles 'on' automatically, and if I turn off my VPN it toggles itself back 'on' so long as I keep my terminal open. However, if I run the script as any kind of startup script, after I reboot, the VPN will toggle 'on' then 'off' and I get a VPN Failed message. And this will keep happening at whatever duration you have set in the script. This generic script is 30secs, I set my personal one to 5secs and it toggles 'on' fails then toggles 'off' every 5secs.