laurent22 / rsync-time-backup

Time Machine style backup with rsync.
3.38k stars 446 forks source link

Won't work with Launchd #207

Open debaron opened 4 years ago

debaron commented 4 years ago

Can someone please tell me so I stop tearing my hair out:

I DON'T want to use crontab.

nalexn commented 4 years ago

Ok, I just got it working with launchd. I'm not able to write a detailed guide right now, but I hope you can google each step for details.

  1. Create a shell script that runs the rsync-time-backup, make sure it works when you run it manually from the terminal
  2. Open Automator and create an "app" that simply runs that script and does nothing else
  3. Under system preferences, grant this app "full disk access" permission
  4. Create plist for the launchd that runs that app. Below is an example that runs the app every 10 seconds
  5. Put that plist in ~/Library/LaunchAgents/.plist and load with command launchctl load ...
  6. Done!
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.rsync.backup</string>
    <key>ProgramArguments</key>
    <array>
      <string>open</string>
      <string>-a</string>
      <string>/Users/<you>/Scripts/rsync/rsync_run.app</string>
    </array>
    <key>StartInterval</key> 
    <integer>10</integer>
    </dict>
    </plist>