diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000000000000000000000000000000000..7ead3730466988fa05f9c5f145492dc39aeeaebd --- /dev/null +++ b/ChangeLog @@ -0,0 +1,18 @@ +2006-10-14 Per Cederqvist <ceder@lysator.liu.se> + + Initial checkin of the proof-of-concept scripts used to backup + some of the most important data on Lysator to sedesopim. + + * fetch-backup-work: New script. Define all backup tasks by + quering auto_home on nema, and listing certain directories on + stalingrad and uhumhummy. As set up, this will find home + directories, user www directories that use Apache (not Roxen), and + CVS and SVN projects on the stalingrad server. Note, however, + that only a select few of the tasks are actually selected, due to + the current disc shortage on sedesopim. + + * backup-one-task: New script. Run rdiff-backup to back up one + task. + + * backup-all: New script. This script repeatedly calls + backup-one-task for all defined tasks. diff --git a/backup-all b/backup-all new file mode 100755 index 0000000000000000000000000000000000000000..94473d0ec358155ed9488bbcc7a4b1693c5bbe00 --- /dev/null +++ b/backup-all @@ -0,0 +1,11 @@ +#!/bin/sh + +df -h /nobackup/backup.lysator/backups + +while read category subcategory server serverpath +do + /nobackup/backup.lysator/bin/backup-one-task \ + "$category" "$subcategory" "$server" "$serverpath" +done < /nobackup/backup.lysator/var/tasks + +df -h /nobackup/backup.lysator/backups diff --git a/backup-one-task b/backup-one-task new file mode 100755 index 0000000000000000000000000000000000000000..f0c918e8413b37605fee51809ccf4920a6ac365d --- /dev/null +++ b/backup-one-task @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ $# != 4 ] +then + echo $0: usage: $0 category subcategory server serverpath >&2 + echo Example: $0 home ceder inservitus /export/home/ceder >&2 + exit 1 +fi + +category="$1" +subcategory="$2" +server="$3" +serverpath="$4" + +case "$server" in + manhattan) remoterdiff=/usr/bin/rdiff-backup;; + stalingrad) remoterdiff=/usr/bin/rdiff-backup;; + *) remoterdiff=/usr/local/bin/rdiff-backup;; +esac + +base="/nobackup/backup.lysator/backups/$category/$subcategory" +exclude="$base"/exclude +files="$base"/files + +mkdir -p "$files" +rm -f "$exclude" + +# Fetch an up-to-date exclude file. +scp -i /root/.ssh/backupkey "$server":"$serverpath"/.lysbackupexclude \ + "$exclude" + +rdiff-backup --exclude-other-filesystems --null-separator \ + --remote-schema \ + 'ssh -a -k -x -i /root/.ssh/backupkey %s '$remoterdiff' --server' \ + "$server"::"$serverpath" "$files" \ + && touch "$base"/last-good-backup diff --git a/fetch-backup-work b/fetch-backup-work new file mode 100755 index 0000000000000000000000000000000000000000..9fa70b11184938b5a99b3988f3864bed81467cf6 --- /dev/null +++ b/fetch-backup-work @@ -0,0 +1,35 @@ +#!/bin/sh + +rm /nobackup/backup.lysator/var/tasks + +ssh stalingrad ls -1 /svnroot \ + | sort \ + | head -10 \ + | awk '{print "lsvn", $1, "stalingrad /svnroot/" $1}' \ +>> /nobackup/backup.lysator/var/tasks + +ssh stalingrad ls -1 /cvsroot \ + | sort \ + | head -10 \ + | awk '{print "lyscvs", $1, "stalingrad /cvsroot/" $1}' \ +>> /nobackup/backup.lysator/var/tasks + +ssh uhumhummy ls -1 /lysator/lyswww/users/common \ + | grep -v USAGE \ + | grep -v THIS_IS_USERWEB \ + | grep -v '^cap\.fm$' \ + | sort \ + | grep -v '^a' \ + | grep -v '^b' \ + | head -50 \ + | awk '{print "lyswww", $1, "uhumhummy /lysator/lyswww/users/common/" $1}' \ +>> /nobackup/backup.lysator/var/tasks + +ssh nema.lysator.liu.se ypcat -k auto_home \ + | sort \ + | grep -v DELETE \ + | grep -v '^ *$' \ + | head -75 \ + | sed 's/:/ /' \ + | sed 's/^/home /' \ +>> /nobackup/backup.lysator/var/tasks