the third flag * specifies the day of month, every day if week day not specified.the second 0 specifies the hour, use * for every hour.
Examples:Ī.) For example, to run a python3 script under my Documents folder at midnight (00:00) every Sunday, use: 0 0 * * 0 python3 /home/ji/Documents/script.py The first 5 asterisks “*” specify the time and date, change them accordingly. Now scroll down and add a new line: * * * * * Set time interval, command or script to run periodically:Īfter running a command in step 1, it opens the configuration file in the terminal window (or command console). User can be root, so it will do the same to sudo crontab -e: sudo crontab -u root -eĢ. You can add -u flag to specify the user, ji for instance. It will create (if not exit) or open the configuration file for root user.Ĭ.) Specify a user to run the schedule task: Choose one you prefer or press Enter to use the default nano text editor.įor command or script need sudo or root user privilege, you may run following command instead: sudo crontab -e To run command or script by current user, simply open terminal from system app launcher and run command: crontab -eįor the first time, it will prompt to select an editor to edit the config file. And each user has its own crontab config file. It’s pre-installed in Ubuntu based systems. Users can set up a cron job easily by configuring crontab file by crontab command. It’s typically used for system maintenance or administration, though it can be useful for general purpose, e.g., downloading file from internet at regular intervals. Want to run a command or a script daily, weekly, monthly, or on other given schedule? It’s easy to do this in Ubuntu via cron job.Ĭron is a time-based job scheduler to run command or script periodically at fixed times, dates, or intervals.