LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-15-2006, 09:41 AM   #1
jamespetts
Member
 
Registered: Sep 2002
Location: UK
Distribution: Ubuntu 11.10
Posts: 113

Rep: Reputation: 15
Post Backup shell script not working properly


I was not sure whether to post this here or in "programming", so apologies if I've got the wrong forum.

In February, I wrote a shell script (using rsync) for automated backups in my home network (a Linux computer running in the bedroom backing up other computers in the house).

However, recently, I have noticed that not all files are backing up: new subdirectories, for example, of directories that the script is set to include will be backed up to the backup volume, but, bizarrely, their contents will not. I have also noticed that e-mail folders don't back up, even though they are set to do so.

I'm not entirely sure what the problem is, and was rather hoping that somebody could help. I will reproduce my backup script below: can anybody spot any flaws?

Code:
#Shell script for home backup using rsync.
#Ver 2.0
#by James E. Petts
#
#
# The following line is the correct crontab entry for this backup script:
# 0 14 * * * /backup/autoback.sh > "/backup/Logs/autoback_`date +%e_%b_%G`.log"
#
echo
echo "*** Automatic backup for PettsNet ***"
echo "Ver 2.0, 19th of February 2006."
echo
echo "Backup commenced at: "
date -R
echo
lastset=`tail -n 1 /backup/Logs/set.log`
if [ $lastset == 0 ]
then
set=1
elif [ $lastset == 1 ]
then
set=0
else
echo "There is an error with the backup sets logfile. Will back up to set 0."
set=0
fi
# ***
echo "Backing up core directories..."
echo
for (( i = 1; i < 10000; i++ ))
do
line=`head -n $i /backup/autoback_core.list | tail -n 1`
if  [ "$line" == EOF ]
then
i=10001
else
echo "Backing up" $line "to backup set" $set ...
rsync -a -v --modify-window=1 --exclude "*.iso" "$line" "/backup/Scheduled Backups/Set"$set
fi
done
echo
# ***
echo "Backing up core directories with /My Videos exclusions..."
echo
for (( i = 1; i < 10000; i++ ))
do
line=`head -n $i /backup/autoback_exclude.list | tail -n 1`
if  [ "$line" == EOF ]
then
i=10001
else
echo "Backing up" $line "to backup set" $set ...
rsync -a -v --modify-window=1 --exclude "My Videos/" "$line" "/backup/Scheduled Backups/Set"$set
fi
done
echo
# ***
echo "Backing up other directories..."
echo
for (( i = 1; i < 10000; i++ ))
do
line=`head -n $i /backup/autoback_others.list | tail -n 1`
if  [ "$line" == EOF ]
then
i=10001
else
echo "Backing up" $line "to backup set 0"... 
rsync -a -v --modify-window=1 --exclude "*.iso" "$line" "/backup/Scheduled Backups/Set0"
fi
done
echo
# ***
echo "Backing up deletion reciprocation directories..."
echo
for (( i = 1; i < 10000; i++ ))
do
line=`head -n $i /backup/autoback_delete.list | tail -n 1`
if  [ "$line" == EOF ]
then
i=10001
else
echo "Backing up" $line "to backup set 0"...
rsync -a -v --modify-window=1 --delete --exclude "*.iso" "$line" "/backup/Scheduled Backups/Set0"
fi
done
echo
# ***
echo
echo "Backup finished at:"
date -R
echo
echo `date -R` >> /backup/Logs/set.log
echo $set >> /backup/Logs/set.log
echo "Automated backup software using rsync created by James E. Petts"
echo
 
Old 07-15-2006, 10:13 AM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Try using rsync with two -v switches, it will tell you why it skips a file.
 
Old 07-15-2006, 11:03 AM   #3
jamespetts
Member
 
Registered: Sep 2002
Location: UK
Distribution: Ubuntu 11.10
Posts: 113

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by spirit receiver
Try using rsync with two -v switches, it will tell you why it skips a file.
Aha, cunning, thank you, I'll try it :-)
 
  


Reply

Tags
backup, script, shell


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script not functioning properly jordanmc31 Programming 21 04-17-2006 06:35 AM
Shell Script for backup BBQ_Matt Linux - Software 7 06-30-2005 05:19 PM
Incremental Backup shell script. datadriven Linux - General 3 06-02-2004 09:19 AM
writting a backup shell script yenonn Slackware 2 03-18-2004 07:49 PM
bash shell backup script turnip Programming 0 04-03-2003 06:00 PM


All times are GMT -5. The time now is 04:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration