The trick is... there is no crontab on Mac since 6-7 years. You must use launchctl to schedule a "cron job".

In my case, I simply want to run a bash script for my local backup. I guess that if you are confortable running cron jobs on Linux, you will be at home with these instructions.

How To

cd ~/Library/LaunchAgents
nano com.pascalandy.macbackup.plist

launchctl load ~/Library/LaunchAgents/com.pascalandy.macbackup.plist
launchctl list | grep 'pascalandy'
launchctl unload ~/Library/LaunchAgents/com.pascalandy.macbackup.plist

Code example

XML format:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>

        <key>Label</key>
        <string>com.pascalandy.macbackup</string>

        <key>ProgramArguments</key>
        <array>
            <string>/bin/bash</string>
            <string>/Volumes/960G/_pascalandy/macbkp/runup.sh</string>
        </array>

        <key>LowPriorityIO</key>
        <true/>

        <key>Nice</key>
        <integer>1</integer>

        <key>StartCalendarInterval</key>
        <dict>
            <key>Hour</key>
            <integer>11</integer>
            <key>Minute</key>
            <integer>39</integer>
        </dict>

    </dict>
</plist>

Sources

If you need more blabla, there you go :)



You've successfully subscribed to FirePress
Welcome back! You've successfully signed in.
Great! You've successfully signed up.
Success! Your account is fully activated, you now have access to all content.