Mac - rsync

Auf dem Server muss rsync installiert sein.

# portmaster net/rsync

backup

Shell-Script für den Mac

#!/bin/csh

set LogPath = "~/Library/Logs/rsync.log"
set ExlPath = "/backup/_inc/exclude.server.com.txt"
set Quelle = "user@server.com:/backup/"
set Ziel = "/backup/server.com"

/bin/echo "------------------------" > $LogPath
/bin/echo "--- server.com ---" >> $LogPath
/bin/echo "------------------------" >> $LogPath

/usr/bin/rsync --rsh='ssh -p22' -avP --log-file=$LogPath --stats --delete $Quelle $Ziel

/bin/echo "------------------------" >> $LogPath
/bin/echo "--- ende ---------------" >> $LogPath
/bin/echo "------------------------" >> $LogPath

/Library/LaunchAgents/com.server-backup.plist

<?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.server-backup</string>
    <key>ProgramArguments</key>
    <array>
        <string>/backup/backup.sh</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>5</integer>
        <key>Minute</key>
        <integer>15</integer>
    </dict>
</dict>
</plist>

start

# launchctl load -w /Library/LaunchAgents/com.server-backup.plist

stop

# launchctl unload -w /Library/LaunchAgents/com.server-backup.plist

Mailserver

Ist der Server ein IMAP, dann rsync mit dem -avP Flag starten

# /usr/bin/rsync --rsh='ssh -p22' -avP --log-file=$LogPath --stats --delete $Quelle $Ziel