Running scripts on my Macbook Air was a challenge for me . I did some research and found that if you are on a Mac (or Linux), you can use
crontab , which is a scheduling tool that will run jobs (scripts) at regular intervals.
crontab can be edited by editing the job list.We can specify the cronjob in the following format (first line):
We can understand by using a simple example job. Lets create a simple cronjob to copy a particular file say "mysecretfile.txt" to a particular folder say "secretfolder" , and set this up to run once a day.
We'll set it to run as a cronjob by editing the job list (with the
env EDITOR=nano crontab -e
0 12 * * * cp ~/mysource-folder/mysecretfile.txt ~/secretfolder/
This will execute the command every day at 12:00, which changes to the folder of the file and copies it.
Notice that if your computer is shut down or sleeping at the time, the script will not run until the next day at the specified time.
To see a list of your active crontab jobs, use the following command:
Disable email alerts
So after everything is set up, you might notice that the Terminal suddenly have started sending you e-mails.
You can disable this behaviour by inserting this line at the very top of your crontab file: