What is cron, crontab and cronjob?
Cron is a program that allows a task to be scheduled for execution at a specific time in a Linux system. This specific time could be a specified day, hour or minute as specified in a cron tab ( cron table).
A cron tab is a configuration file that specifies commands to run periodically on a given schedule .
A cron job is a scheduled command that is to run after a specified period. ( Pretty repetitive, right ?)
Where does a cron job run
A cron job runs in the home directory of the user who created it. For instance, say we have a script called cron_job.py and we have set it to run after every 1 minute. It will always be executed as if it is has been executed at $HOME as python3 cron_job.py.
However, if you want to run it in a folder that is located at $HOME called cron_folder . When setting the cron job, you have to cd into cron_folder then run the script. For this case when setting the cron job, the exact syntax will be cd cron_folder && python3 cron_job.py
How to see existing cron tabs
To see the cron tab associated with the user you are logged in as, on the terminal type out crontab -l and see the output. If there is nothing, do know there is no cron tab available.
PS; This entry assumes you are running a Linux instance
Adios, until next entry π
Leave a comment