Skip to main content

1. Creating Cron Jobs

This will describe how to create cron jobs on Fedora Server to run bash scripts (That is scripts ending with .sh)

How to set up:

  • First ensure that you have created your script.sh file in a directory, let's say /home/user/script.sh
  • Then enter sudo chown user:user script.sh, to change the owner of file to your user
  • cd /home/user change directory into your home directory
  • Next enter sudo chmod +x script.sh, to give the file executable permission
  • Test run the script by entering ./script.sh
  • Verify it runs successfully, and that there are no issues
  • Next visit crontab.guru, and edit the values to how frequently you want to script to be automatically run
  • Next, go back into your terminal, cd, and enter EDITOR="nano" crontab -e
  • This will bring up a text file. Enter the value you configured on crontab.guru and then enter location of script:
  • 10 2 * * * /home/user/script.sh
  • Once your happy with what you've entered, press Ctrl + X,y and Enter to save.
  • And with thatm you've successfully set up your crontab on fedora server!

For ubuntu the steps are identical. Follow them exactly