- Timestamp:
- 03/27/17 16:23:26 (8 years ago)
- Branches:
- master, perl-5.22
- Children:
- f651f1e
- Parents:
- 577e6d3
- Location:
- npl/syn3/backup
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
npl/syn3/backup/backup
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Backup script for Syn3 (C)DatuX 2 #Backup script for Syn3 (C)DatuX 3 3 4 4 name='backup' 5 source /etc/backup.conf || exit 1 6 source $SCRIPTDIR/backuplib || exit 1 7 8 #load additional backup config file? 9 if [ -e "$BACKUP_CONF" ]; then 10 source $BACKUP_CONF || exit 1 11 fi 5 source /usr/backup/backuplib || exit 1 12 6 13 7 … … 21 15 #nope, so exit cleanly 22 16 exit 0 23 fi 17 fi 24 18 fi 25 19 … … 66 60 echo "INFO:Backup session ended" 67 61 exit $1 68 } 69 70 71 62 } 63 64 65 72 66 echo "INFO: Backup session started at `date`" 73 67 if [ "$1" == "now" ]; then … … 97 91 ROOTFS=$SNAPMNT 98 92 fi 99 93 100 94 #rsync the root+boot filesystem data 101 95 echo "INFO: Collecting / and /boot ..." 102 rsync -ax -q --ignore-errors --numeric-ids --delete --exclude=/tmp/* --exclude=/dev/.udev /boot $ROOTFS/. "$BACKUPMNT/.syn3systembackup" 96 rsync -ax -q --ignore-errors --numeric-ids --delete --exclude=/tmp/* --exclude=/dev/.udev /boot $ROOTFS/. "$BACKUPMNT/.syn3systembackup" 103 97 err=$? 104 98 #ignore some errors (partial transfers, vanishing files) … … 128 122 #note: on redundant systems /dev/home points to /dev/drbd.. instead of /dev/syn3/home, so this is why we need this extra variable: 129 123 Snapshot $SNAPSOURCEDEV || terminated 130 124 131 125 #unfreeze the databases 132 126 unfreeze 133 127 134 128 echo "INFO: Checking snapshots." 135 129 if ! SnapshotValid; then … … 152 146 fi 153 147 done 154 sync 148 sync 155 149 #dump the normal location. 156 150 DUMPMNT=$BACKUPMNT … … 174 168 while true; do 175 169 if [ $mode == "smb" ]; then 176 xfsdump -e -o -p 10 -F - $resumeflag $OPTS $DUMPMNT | gzip --fast | smbclient --timeout 3600 -s /dev/null -c "put - $FILE" -U "$smbuser" -W "$smbdomain" "//$smbserver/$smbshare" "$smbpasswd" 170 xfsdump -e -o -p 10 -F - $resumeflag $OPTS $DUMPMNT | gzip --fast | smbclient --timeout 3600 -s /dev/null -c "put - $FILE" -U "$smbuser" -W "$smbdomain" "//$smbserver/$smbshare" "$smbpasswd" 177 171 #also check xfsdump exit code to prevent samba exit-code bug: https://bugzilla.samba.org/show_bug.cgi?id=7551 178 if [ "$?${PIPESTATUS[0]}" != "00" ]; then 172 if [ "$?${PIPESTATUS[0]}" != "00" ]; then 179 173 terminated 180 174 fi 181 175 elif [ $mode == "tape" ]; then 182 xfsdump -e -L "$FILE" -o -p 10 -F -f $TAPEDEV $resumeflag $OPTS $DUMPMNT 176 xfsdump -e -L "$FILE" -o -p 10 -F -f $TAPEDEV $resumeflag $OPTS $DUMPMNT 183 177 elif [ $mode == "usbtape" ]; then 184 xfsdump -e -L "$FILE" -o -b 65536 -p 10 -F -f $TAPEDEV $resumeflag $OPTS $DUMPMNT 178 xfsdump -e -L "$FILE" -o -b 65536 -p 10 -F -f $TAPEDEV $resumeflag $OPTS $DUMPMNT 185 179 elif [ $mode == "rsync" ]; then 186 180 export PASSWD="$rsyncpasswd" … … 198 192 else 199 193 echo "Backupmode $mode is unknown!"; 200 terminated 194 terminated 201 195 fi 202 196 if [ $? == 0 ]; then … … 229 223 fi 230 224 done 231 ) 2>&1 | 225 ) 2>&1 | 232 226 #analyse the output of the above block 233 while read LINE; do 227 while read LINE; do 234 228 ProcXfsOutput "$LINE" || terminated 235 done 229 done 236 230 237 231 #did something go wrong? -
npl/syn3/backup/backuplib
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 3 source /etc/backup.conf || exit 1 4 5 #load additional backup config file? 6 if [ -e "$BACKUP_CONF" ]; then 7 source $BACKUP_CONF || exit 1 8 fi 9 2 10 3 11 #correct ssh command and parameters for rsync backups, to force passwords and disable pubkeyauthentication. (it seems wrong, but in this use-case it actually makes sense) -
npl/syn3/backup/cleanup
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Backup script for Syn3 (C)DatuX 3 source /etc/backup.conf || exit 1 4 source $SCRIPTDIR/backuplib || exit 1 5 2 #Backup script for Syn3 (C)DatuX 3 source /usr/backup/backuplib || exit 1 6 4 #skip cleanup for tapes 7 5 if [ $mode == "tape" ]; then … … 33 31 34 32 echo "INFO:Checking for old backups that can be deleted.." 35 for FILE in `$SCRIPTDIR/list`; do 33 for FILE in `$SCRIPTDIR/list`; do 36 34 [ "$FILE" == "$SKIPFILE" ] && continue; 37 35 … … 53 51 fi 54 52 fi 55 53 56 54 #not in future? 57 if [ $STAMP -lt $NOW ]; then 55 if [ $STAMP -lt $NOW ]; then 58 56 if [ $DEL == 1 ]; then 59 echo "INFO:Deleting $FILE" 57 echo "INFO:Deleting $FILE" 60 58 $SCRIPTDIR/delete "$FILE" || exit 1 61 59 fi -
npl/syn3/backup/delete
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Backup script for Syn3 (C)DatuX 3 source /etc/backup.conf || exit 1 4 source $SCRIPTDIR/backuplib || exit 1 2 #Backup script for Syn3 (C)DatuX 3 source /usr/backup/backuplib || exit 1 5 4 6 5 FILE=$1 -
npl/syn3/backup/list
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Backup script for Syn3 (C)DatuX 3 source /etc/backup.conf || exit 1 4 source $SCRIPTDIR/backuplib || exit 1 2 #Backup script for Syn3 (C)DatuX 3 source /usr/backup/backuplib || exit 1 5 4 cd / 6 5 … … 16 15 /usr/backup/sshpass rsync $RSYNC_SETTINGS --rsh "$SSHCMD" -v -R -n --no-implied-dirs "$rsyncserver:$rsyncdir/syn3backupmeta/syn3_*" /tmp/backupmetadummy/ > /tmp/syn3backuplastest.$$; 17 16 RET_LATEST=$? 18 19 /usr/backup/sshpass rsync $RSYNC_SETTINGS --rsh "$SSHCMD" -v -R -n --no-implied-dirs "$rsyncserver:$rsyncsnapdir/syn3backupmeta/syn3_*" /tmp/backupmetadummy/ > /tmp/syn3backupsnapshots.$$; 17 18 /usr/backup/sshpass rsync $RSYNC_SETTINGS --rsh "$SSHCMD" -v -R -n --no-implied-dirs "$rsyncserver:$rsyncsnapdir/syn3backupmeta/syn3_*" /tmp/backupmetadummy/ > /tmp/syn3backupsnapshots.$$; 20 19 RET_SNAPSHOTS=$? 21 20 22 21 #TODO: create a nice way to do error feedback (needs webint changes) 23 22 … … 30 29 [ "${rsyncdir:0:1}" == "/" ] && SLASH="/" 31 30 [ "$RET_LATEST" == "0" ] && grep syn3_ /tmp/syn3backuplastest.$$ | sed "s@^@$SLASH@" 32 31 33 32 rm /tmp/syn3backuplastest.$$ /tmp/syn3backupsnapshots.$$ 34 33 exit 0 -
npl/syn3/backup/listfiles
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Backup script for Syn3 (C)DatuX 3 source /etc/backup.conf || exit 1 4 source $SCRIPTDIR/backuplib || exit 1 2 #Backup script for Syn3 (C)DatuX 3 source /usr/backup/backuplib || exit 1 5 4 cd / 6 5 … … 17 16 xfsrestore -p 10 -L "$FILE" -t -v 0 -f "$TAPEDEV" -F || exit 1; 18 17 elif [ $mode == "usbtape" ]; then 19 xfsrestore -p 10 -L "$FILE" -t -v 0 -f "$TAPEDEV" -F -b 65536 || exit 1; 18 xfsrestore -p 10 -L "$FILE" -t -v 0 -f "$TAPEDEV" -F -b 65536 || exit 1; 20 19 else 21 20 echo "Backupmode $mode is unknown!"; … … 24 23 #Analyse the output of the above block 25 24 #This will produce progress-information to filehandle 3 for the SCC to pickup. 26 tee "$FILELISTCACHEDIR/tmp" | 25 tee "$FILELISTCACHEDIR/tmp" | 27 26 grep --line-buffered "^xfsrestore:" | #only use lines that are important for procxfsoutput (because its slow!) 28 27 while read LINE; do … … 34 33 #filter the xfsrestore status messages from our precious listfile :) 35 34 grep -v "^xfsrestore:" "$FILELISTCACHEDIR/tmp" > "$FILELISTCACHEDIR/$FILE" || exit 1 36 rm "$FILELISTCACHEDIR/tmp" 35 rm "$FILELISTCACHEDIR/tmp" 37 36 fi 38 37 -
npl/syn3/backup/restore
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Restore script for Syn-3 (C)DatuX 3 source /etc/backup.conf || exit 1 4 source $SCRIPTDIR/backuplib || exit 1 2 #Restore script for Syn-3 (C)DatuX 3 source /usr/backup/backuplib || exit 1 5 4 6 5 FILE=$1 … … 41 40 syn3-state backup ALERT "Disaster restore started. Your system is unusable until the restore has completed." 42 41 43 ############################# 42 ############################# 44 43 echo "STAT:Preparing $BACKUPDEV" 45 44 … … 79 78 ( 80 79 if [ $mode == "smb" ]; then 81 smbclient --timeout 3600 -s /dev/null --stderr -c "get $FILE -" -U "$smbuser" -W "$smbdomain" "//$smbserver/$smbshare" "$smbpasswd" | gunzip | xfsrestore -o -p 10 -F - $BACKUPMNT || terminated 80 smbclient --timeout 3600 -s /dev/null --stderr -c "get $FILE -" -U "$smbuser" -W "$smbdomain" "//$smbserver/$smbshare" "$smbpasswd" | gunzip | xfsrestore -o -p 10 -F - $BACKUPMNT || terminated 82 81 [ "${PIPESTATUS[0]}" != "0" ] && terminated "Error while reading from fileserver." 83 82 exit 0 … … 92 91 else 93 92 echo "Backupmode $mode is unknown!"; 94 terminated 93 terminated 95 94 fi 96 ) 2>&1 | 95 ) 2>&1 | 97 96 #analyse the output of the above block 98 while read LINE; do 97 while read LINE; do 99 98 ProcXfsOutput "$LINE" || terminated 100 done 99 done 101 100 102 101 #something went wrong? … … 109 108 #Look at: http://open.syn3.nl/syn3/trac/default/wiki/SynBackup for technical details. 110 109 111 #we have a systembackup to restore? 110 #we have a systembackup to restore? 112 111 if [ -e $BACKUPMNT/.syn3systembackup ]; then 113 112 #touch this file so the initrd will format / and /boot and copy the data there. -
npl/syn3/backup/restorefiles
r577e6d3 r595c2eb 1 1 #!/bin/bash 2 #Backup script for Syn3 (C)DatuX 3 source /etc/backup.conf || exit 1 4 source $SCRIPTDIR/backuplib || exit 1 2 #Backup script for Syn3 (C)DatuX 3 source /usr/backup/backuplib || exit 1 5 4 6 5 FILENAME=$1; … … 30 29 smbclient --timeout 3600 -s /dev/null -c "get $FILENAME -" -U "$smbuser" -W "$smbdomain" "//$smbserver/$smbshare" "$smbpasswd" |gunzip| eval xfsrestore -p 10 - -o -F $FILEPATHS "$DESTINATION" || exit 1; 31 30 elif [ $mode == "tape" ]; then 32 #echo xfsrestore -p 10 -L "$FILENAME" -o -F $FILEPATHS -f "$TAPEDEV" "$DESTINATION" 31 #echo xfsrestore -p 10 -L "$FILENAME" -o -F $FILEPATHS -f "$TAPEDEV" "$DESTINATION" 33 32 eval xfsrestore -p 10 -L "$FILENAME" -o -F $FILEPATHS -f "$TAPEDEV" "$DESTINATION" || exit 1; 34 33 elif [ $mode == "usbtape" ]; then … … 37 36 echo "Backupmode $mode is unknown!"; 38 37 fi 39 ) 2>&1 | 38 ) 2>&1 | 40 39 #analyse the output of the above block 41 while read LINE; do 40 while read LINE; do 42 41 ProcXfsOutput "$LINE" || exit 1 43 42 done 44 -
npl/syn3/backup/syn3backup.build
r577e6d3 r595c2eb 1 65 481 6550 -
npl/syn3/backup/syn3backup.md5
r577e6d3 r595c2eb 1 ecf10c7e2ebe7c09da6bae104fb0b3ca./backup1 17d2ccbdcf7937a1ef1134ba7c4b0378 ./backup 2 2 779c5c089a832327ff56b7db1d89ea25 ./backup.conf 3 609916f5b9856ac6c00229628e959bf0./backuplib4 00f891dd773d85750d8212f0ba02e246./cleanup5 3cdeb17172997c4ecc3c27fa187b0fa1./delete6 fadfc8742aed0b81297765b9e4350e3f./list7 137c782694746269699bb022b6b647e9./listfiles3 19499d91077241a779176b275081aa96 ./backuplib 4 5fd22ce56460e9ab76641f1f322bd30f ./cleanup 5 a65357fe969b583c6220300ae54316b4 ./delete 6 b97e0e1bf8be8787d71c763f8fd56550 ./list 7 8964fa790326d3924faf0a3a0253fe56 ./listfiles 8 8 2016cc75fdc0fc52998a1d2291395879 ./modules/mysql.backup 9 9 b07c8333373794830b95567130ffd821 ./modules/mysql.freeze … … 22 22 cc0682867de94c1ccb2163e2fb1856e8 ./post.backup 23 23 7158d3d4117bda9ee72ff6542bd141d7 ./post.restore 24 5c6a3e0a4f34e7e9a30c534a4e3e44c5./restore25 a5c8f09a59ffb86f65344f20926f1b61./restorefiles24 bd04ec4ba9f753e1b36ecaec9be394e2 ./restore 25 b42907f76531300850bad1104e2f6bdf ./restorefiles 26 26 478387d5e8c95cee3c270858e930b2ba ./sshpass 27 02c74cd009a095c929b0f182fe837990./syn3backup.pkg27 16227d7d8c11b00394b292ebd0615612 ./syn3backup.pkg 28 28 6e3b8805854d12fd1b73056e96357640 ./syn3backup.SlackBuild 29 0c7e2234bb90f7a43a8e9fd1b053eea5./syn3backup.SlackBuild.log.gz29 d8c0858eb5e6dbc3d4589b5ee548b579 ./syn3backup.SlackBuild.log.gz 30 30 ac50b66df20fa5fee5fb8ec431ede26e ./updatelang.sh -
npl/syn3/backup/syn3backup.pkg
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
Note: See TracChangeset
for help on using the changeset viewer.