Skip to content

Instantly share code, notes, and snippets.

@blissini
Last active March 21, 2017 10:42
Show Gist options
  • Save blissini/eb2e09ea9d0d310ad60d4e8bdd74515a to your computer and use it in GitHub Desktop.
Save blissini/eb2e09ea9d0d310ad60d4e8bdd74515a to your computer and use it in GitHub Desktop.
#!/bin/bash
# basic config
RSYNC_BINARY="/usr/bin/rsync"
RUNFILE="/tmp/surbl_sync"
IOTIMEOUT=60
# config invalue
SERVER1="rsync.invaluement.com"
REMOTE_PATH1="invaluement.com.rbldnsd"
ZONESDIR1="/usr/local/rbldnsd/data/invaluement.com"
# config surbl.org
SERVER2="blacksync.prolocation.net"
REMOTE_PATH2="surbl"
ZONESDIR2="/usr/local/rbldnsd/data/surbl.org"
echo "Ok, Checking for run file"
if [ -e $RUNFILE ]; then
echo "$RUNFILE exists, rsync running?"
exit 1;
else
touch $RUNFILE
fi
echo "Starting sync with $SERVER1 ..."
$RSYNC_BINARY -v -T /tmp -trlv --timeout=$IOTIMEOUT $SERVER1::$REMOTE_PATH1 $ZONESDIR1
echo "Finished sync with $SERVER1 ..."
echo "Starting sync with $SERVER2 ..."
$RSYNC_BINARY -v -T /tmp -trlv --timeout=$IOTIMEOUT $SERVER2::$REMOTE_PATH2 $ZONESDIR2
echo "Finished sync with $SERVER2 ..."
echo "Cleaing up ..."
if [ -e $RUNFILE ]; then
rm -f $RUNFILE
fi
echo "Finished ..."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment