Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/ash
- export PATH=/sbin:/bin
- #PXE boot?
- if [ ! -d /bootbank ]; then
- exit 1
- fi
- first=0
- if esxcfg-info -e; then
- if [ ! -f /bootbank/local.tgz ]; then
- first=1
- else
- mkdir -p /tmp/auto-backup.$$.dir
- cp /bootbank/local.tgz /tmp/auto-backup.$$.dir
- fi
- else
- if [ ! -f /bootbank/state.tgz ]; then
- first=1
- else
- mkdir -p /tmp/auto-backup.$$.dir
- tar zxvf /bootbank/state.tgz -C /tmp/auto-backup.$$.dir
- fi
- fi
- if [ "$first" = "1" ]; then
- #always do the first one
- backup.sh 0
- if [ $? -ne 0 ]; then
- logger "Auto-Backup failed"
- fi
- exit 0
- fi
- tar zxvf /tmp/auto-backup.$$.dir/local.tgz -C /tmp/auto-backup.$$.dir
- filestosave=`find /etc -follow -type f -name ".#*" | sed 's/\.#\(.*\)/\1/g'`
- for filename in $filestosave
- do
- diff -N $filename /tmp/auto-backup.$$.dir$filename
- if [ $? -ne 0 ]; then
- backup.sh 0
- if [ $? -ne 0 ]; then
- logger "Auto-Backup failed"
- fi
- break
- fi
- done
- #clean up
- rm -rf /tmp/auto-backup.$$.dir
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement