There may be times when we want to run a job on Monsoon daily or on another regular basis. Since Monsoon is a linux based system, we may use the cron facility to do this.
On linux, cron is a time-based scheduler, not to be confused with slurm which is used to schedule slurm jobs. You may use cron to schedule jobs to run periodically at fixed times, dates, or intervals.
A good webpage about cron may be found at https://opensource.com/article/17/11/how-use-cron-linux
As an example, let’s say we have a jobscript named daily-analysis.sh that needs to be executed each day at 1pm. I would do the following.
Execute the cron editing tool by entering the following command at the command line:
crontab -e
You will be in an editing session using the vi editor. You must be familiar with vi to do this.
In vi you will enter the following line:
0 13 * * * /home/myuid/daily-analysis.sh
Where myuid is my monsoon id. The script will be a bash script that can do whatever you want including sbatching jobscripts. This could including downloading data, etc.
The general syntax for a cron entry is:
# Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * command to be executed
Once you set up cron, as long as you have a working jobscript then the job would run each day at 1 pm (13:00 hours).
Another resource that is helpful is crontab guru at https://crontab.guru/