Sunday, March 6, 2016

Getting a script to run on boot, not on login



How can I get a specific script to run (preferably not as superuser) whenever the machine boots, but before login. It can be the last thing to run on boot. I mostly just want the script to work even if no user logs in.



I would recommend using cron. The special time value of @reboot will spawn your job at each reboot as your user. For example, run crontab -e and use:



@reboot /home/yourself/bin/some_script_to_run



For more details on the special time formats, see man 5 crontab


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...