Skip to content

Instantly share code, notes, and snippets.

@iamprogrammerlk
Last active June 11, 2022 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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