- Prepare a bash script to run what ever you like to, in this case, I want to run my Mackup backup to backup all of my settings
1 │ #!/bin/bash
2 │
3 │ cd /Users/turbo/Code/Mackup
4 │ mackup backup -f
5 │ git add .
6 │ git commit -m "Updated changes"
7 │ git push
- Add cronjob for MAC using Crontab
Run
env EDITOR=vim crontab -e
command to open Crontab config file with vim A cron job format is:
- - - - - USER command
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
For example:
1 │ 0 12 * * * cd && ./mackup.sh
Add a cron job and save the file.
- Run
crontab -l
to check if task is added