0 votes
in JavaScript by
How can you run a Bash script at regular intervals using ‘cron’?

1 Answer

0 votes
by

To run a Bash script at regular intervals using ‘cron’, you need to edit the crontab file. Use the command ‘crontab -e’ to open it. In this file, each line represents a job and is structured as follows: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-7 where both 0 and 7 are Sunday), followed by the command or script to be executed. For example, to run a script every Monday at 5 PM, your entry would look like this: “0 17 * * 1 /path/to/script.sh”. The asterisks act as wildcards, meaning any value is acceptable for that field.

...