Skip to content

Instantly share code, notes, and snippets.

@iamprogrammerlk
Last active June 22, 2024 05:34
Show Gist options
  • Save iamprogrammerlk/cb7c3e4eb45b28e8c98f438ad892bf32 to your computer and use it in GitHub Desktop.
Save iamprogrammerlk/cb7c3e4eb45b28e8c98f438ad892bf32 to your computer and use it in GitHub Desktop.
Run a program on Ubuntu at startup - A cron job setup (Tested on Ubuntu 19.10)

You can use the "crontab -e" command to add a program to the cron job scheduler,

so that it will launch it at startup, even if there is no GUI installed (useful for Ubuntu servers).

First config the cronejob

~$crontab -e

Select the text editor (I choosed NANO by hitting 1) Next, scroll to the bottom of the file and add the following line.

@reboot /PATH/TO/EXECUTABLE/FILE

Example if you wanna run firefox add line like this "@reboot firefox". All you really have to remember here is ‘@reboot’. if you have a argumets to run add it after the executable path like this

@reboot firefox -O

Press "Ctrl + O" and hit Enter to save if you'r using Nano, and then "Ctrl + X" to exit. That’s it! Restart the system and see how it's works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment