I am trying to make a cronjob that executes on reboot of my machine. The job is a .sh script that is located in the custom dir start. path from home is: Home/start/start.sh The script needs sudo permissions to run so i edited the cron tab like so: sudo crontab -eu root In this file i added the following line of code: @reboot /home/username/start/start.sh This line is located at the very bottom of the crontab file.

I have never done this before so i have no idea what i am missing or doing wrong :( all suggestions are welcome. If something is unclear let me know so i can clarify.


  • 1
    (1) is the script executable? (2) what does it do? (3) how did you determine that it is not executing? Is the path really /home/start/ or is it /home/username/start? – steeldriver May 31 '18 at 11:59
  • 1. i went to the dir and did chmod 777 script.sh 2. i checked the path with pwd it was indeed home/username/start/script.sh i changed it accordingly 3. the script launches leapd a program for the leapmotion controller and opens a webpage in fullscreen. 4. i noticed it doesnt work because the browser window isnt opening. – FutureCake May 31 '18 at 12:06
  • 1
    Perhaps askubuntu.com/q/514167/504066. Running GUI programs from cron is special. – PerlDuck May 31 '18 at 12:11
  • 2
    cron is not the right tool for opening a GUI program - a whole lot of other stuff needs to be running before that happens. See for example How do I start applications automatically on login? or (if you are looking for a kiosk type setup) Customize Ubuntu for a library Internet kiosk – steeldriver May 31 '18 at 12:14
  • ok thanks i will try that approach! – FutureCake May 31 '18 at 12:18

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.