Update of /cvsroot/fink/scripts/server-admin In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv18361/server-admin
Added Files: README do-backup.sh Log Message: script for backups on finch --- NEW FILE: README --- This is for scripts used on finkproject.org and other such Fink servers. It's mostly meant to be a fallback for if we need to recover a system. --- NEW FILE: do-backup.sh --- #!/bin/sh DATE=`date +'%Y-%m-%d-%H:%M:%S'` LOGFILE="/tmp/backup.log" BACKUPFILE="backup-${DATE}.tar.gz" ACCOUNT="[EMAIL PROTECTED]" KEEP_BACKUPS="7" echo -n "" >"$LOGFILE" do_error() { echo "!!! backup failed: $@" >>"$LOGFILE" cat "$LOGFILE" | while read LINE; do echo " $LINE"; done exit 1; } do_command() { echo "*** running [EMAIL PROTECTED]" >>"$LOGFILE" "$@" >>"$LOGFILE" 2>&1 [ $? -ne 0 ] && do_error "$1 exited non-zero" } do_command tar -C / --exclude='var/www/distfiles' --show-omitted-dirs --totals -czf "/tmp/${BACKUPFILE}" etc home root var usr/local do_command /usr/bin/rsync -av -e 'ssh -i /root/.ssh/id_nopass' "/tmp/${BACKUPFILE}" "$ACCOUNT":~/backups/ do_command rm "/tmp/${BACKUPFILE}" # clear out old backup files COUNT=0 for FILE in `ssh -i /root/.ssh/id_nopass "$ACCOUNT" ls -1 '~/backups/backup*.tar.gz' 2>/dev/null | sort -r`; do let COUNT="$COUNT + 1" if [ "$COUNT" -gt "$KEEP_BACKUPS" ]; then do_command ssh -i /root/.ssh/id_nopass "$ACCOUNT" rm "$FILE" fi done echo "*** done" >>"$LOGFILE" ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fink-commits