0

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.

Thanks

FutureCake
  • 101
  • 2
  • 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 https://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?](https://askubuntu.com/questions/48321/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](https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk) – steeldriver May 31 '18 at 12:14

0 Answers0