![]() |
HowTo.SmartBackupFromOneAttachedDiskToAnotherAttachedDisk HistoryHide minor edits - Show changes to markup January 21, 2009, at 10:02 PM
by --
Changed lines 233-234 from:
->ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh to:
ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh Changed lines 239-240 from:
->ln -s /usr/sbin/sendmail /usr/lib/sendmail to:
ln -s /usr/sbin/sendmail /usr/lib/sendmail January 21, 2009, at 10:02 PM
by -- January 21, 2009, at 10:01 PM
by --
Changed lines 239-240 from:
ln -s /usr/sbin/sendmail /usr/lib/sendmail to:
->ln -s /usr/sbin/sendmail /usr/lib/sendmail January 21, 2009, at 10:01 PM
by --
Changed lines 233-234 from:
ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh to:
->ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh January 21, 2009, at 10:00 PM
by --
Deleted line 232:
Deleted line 238:
January 21, 2009, at 09:59 PM
by --
Changed lines 230-231 from:
to:
Changed lines 234-235 from:
ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh to:
ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh January 21, 2009, at 09:58 PM
by --
Added lines 232-235:
ln -s /etc/init.d/_configure_cron.sh /etc/rcS.d/S99configure_cron.sh January 21, 2009, at 09:53 PM
by --
Added line 236:
January 21, 2009, at 09:52 PM
by --
Changed line 235 from:
Therefore, type the following : to:
Therefore, type the following :
January 21, 2009, at 09:50 PM
by --
Changed line 65 from:
to:
January 21, 2009, at 09:49 PM
by -- Corrections
Changed lines 58-60 from:
ipkg install coreutils ipkg install gawk to:
Changed line 65 from:
ipkg install mailx (available in OpenSlug-2.7)
to:
Added line 72:
Added lines 234-237:
Therefore, type the following : ln -s /usr/sbin/sendmail /usr/lib/sendmail September 30, 2008, at 05:21 PM
by -- context
Added lines 8-9:
I tested this procedure with my Linksys NSLU2, with Openslug 2.7 beta. June 21, 2008, at 04:36 AM
by --
Changed line 81 from:
''NOTE that you will have to make several corrections when using the script in pre-OpenSlug-2.7 environment. Up until OpenSlug-2.7, various system utilities were placed in `/opt/bin` directory. OpenSlug-2.7 probably changes this standard and places them (more appropriately) in `/usr/bin`. Therefore make sure that you change `/usr/bin` to `/opt/bin` in the backup script if you want to use it in OpenSlug-2.6 or earlier distributions.
to:
NOTE that you will have to make several corrections when using the script in pre-OpenSlug-2.7 environment. Up until OpenSlug-2.7, various system utilities were placed in `/opt/bin` directory. OpenSlug-2.7 probably changes this standard and places them (more appropriately) in `/usr/bin`. Therefore make sure that you change `/usr/bin` to `/opt/bin` in the backup script if you want to use it in OpenSlug-2.6 or earlier distributions. June 21, 2008, at 04:34 AM
by -- Comment on backup script usage in pre-OpenSlug-2.7 environment.
Added line 81:
''NOTE that you will have to make several corrections when using the script in pre-OpenSlug-2.7 environment. Up until OpenSlug-2.7, various system utilities were placed in `/opt/bin` directory. OpenSlug-2.7 probably changes this standard and places them (more appropriately) in `/usr/bin`. Therefore make sure that you change `/usr/bin` to `/opt/bin` in the backup script if you want to use it in OpenSlug-2.6 or earlier distributions.
June 21, 2008, at 04:08 AM
by -- Few comments were added.
Changed line 63 from:
ipkg install mailx to:
ipkg install mailx (available in OpenSlug-2.7)
Changed lines 65-67 from:
ipkg install ssmtp to ease the backup to:
ipkg install ssmtp (available in OpenSlug-2.7)
to perform the backup June 21, 2008, at 03:48 AM
by -- \"coreutils\" and \"gawk\" added to list of required ipkg packages
Changed lines 56-58 from:
to:
ipkg install coreutils ipkg install gawk June 10, 2008, at 01:11 PM
by --
Changed lines 173-174 from:
Create the /etc/crontab file : to:
Changed lines 191-192 from:
Create /etc/init.d/_configure_cron.sh : to:
Changed lines 228-229 from:
Edit the /etc/ssmtp/ssmtp.conf : to:
June 10, 2008, at 01:09 PM
by --
Changed lines 52-54 from:
[@ ipkg update to:
ipkg update Changed lines 55-56 from:
ipkg install bash to:
ipkg install bash Changed lines 58-59 from:
ipkg install cron to:
ipkg install cron Changed lines 61-64 from:
ipkg install mailx ipkg install nail ipkg install ssmtp to:
ipkg install mailx ipkg install nail ipkg install ssmtp Changed lines 66-68 from:
ipkg install rsync @] to:
ipkg install rsync June 10, 2008, at 01:08 PM
by --
Changed line 55 from:
to have a real scripting capability
to:
to have a real scripting capability Changed line 58 from:
to schedule the backups
to:
to schedule the backups Changed line 61 from:
to receive the result of the backup by mail
to:
to receive the result of the backup by mail Changed line 66 from:
to ease the backup
to:
to ease the backup June 10, 2008, at 01:07 PM
by --
Changed lines 55-57 from:
ipkg install bash to have a real scripting capability ipkg install cron to schedule the backups ipkg install mailx to receive the result of the backup by mail to:
to have a real scripting capability
ipkg install bash to schedule the backups
ipkg install cron to receive the result of the backup by mail
ipkg install mailx Changed lines 65-67 from:
ipkg install rsync to ease the backup to:
to ease the backup
ipkg install rsync June 10, 2008, at 01:00 PM
by --
Changed lines 65-69 from:
to:
Changed lines 80-81 from:
to:
Changed lines 85-86 from:
to:
Changed lines 121-122 from:
The first file will contains all directories to backup daily. The second file will contains all directories to backup weekly. to:
The first file will contains all directories to backup daily. Changed lines 125-126 from:
I propose to create them in /home/script (the same directory that contains backup.sh). to:
I propose to create them in /home/scripts (the same directory that contains backup.sh). Changed lines 133-136 from:
to:
Changed lines 177-179 from:
to:
Changed lines 182-184 from:
The issue is that the cron will not load correctly the /etc/crontab file at each startup. to:
The issue is that the /etc/crontab file will not be correctly loaded at startup. Added line 186:
Added lines 218-219:
June 10, 2008, at 12:49 PM
by --
Changed lines 65-69 from:
to:
Changed lines 72-73 from:
The script is too long to be included in this procedure. Please follow this link to see the script. to:
The script is too long to be included in this procedure. Please follow this link to see the script.
June 10, 2008, at 12:44 PM
by --
Changed line 18 from:
to:
Changed lines 23-25 from:
to:
Changed lines 27-31 from:
to:
Added line 51:
Added lines 65-69:
June 10, 2008, at 12:39 PM
by --
Changed line 3 from:
You can find many others procedures in this Wiki, each of them fitting a given context. to:
You can find many others backup solutions in this Wiki, each of them fitting a given context.\\ Changed lines 8-12 from:
to:
Changed lines 15-19 from:
to:
Changed line 24 from:
to:
June 10, 2008, at 12:33 PM
by --
Changed lines 10-12 from:
to:
Added line 28:
Deleted lines 49-64:
ipkg update ipkg install bash to have a real scripting capability ipkg install cron to schedule the backups ipkg install mailx to receive the result of the backup by mail ipkg install nail ipkg install ssmtp ipkg install rsync to ease the backup 4. Overview of the procedure5. Step 1 : Backup scriptCreate a script file called backup.sh in /home/scripts'' : Changed lines 51-58 from:
Test 1 to:
ipkg update ipkg install bash to have a real scripting capability ipkg install cron to schedule the backups ipkg install mailx to receive the result of the backup by mail ipkg install nail ipkg install ssmtp ipkg install rsync to ease the backup Changed lines 60-61 from:
to:
4. Overview of the procedure5. Step 1 : Create the backup script
The script is too long to be included in this procedure. Please follow this link to see the script.
Constants you are likely to change
Constants you are not likely to change
Script usageWith no parametersbackup.sh The script will describe shortly how to use this script. With 1 parameter backup.sh DailyBackups?
The first parameters is the name of a file that contains the directory to backup (see Step 2 : Create the configuration file to specify which directories to backup). With 3 parameters (mainly for debugging purposes)backup.sh /home/Outlook Outlook 12 The 3 parameters are exactly equivalent to one line in the previous config file (see Step 2 : Create the configuration file to specify which directories to backup) :
6. Step 2 : Create the configuration file to specify which directories to backupOne configuration file for a given backup frequencyYou must now create one config file for a given backup frequency. For example, if you want to backup daily some directories, weekly others, and montly some others, you have to create 3 config files : The first file will contains all directories to backup daily. The second file will contains all directories to backup weekly. The third file will contains all directories to backup monthly. I propose to create them in /home/script (the same directory that contains backup.sh). The syntax of the configuration fileWhatever the file, the syntax is the same. A configuration file is a set of lines.
Here is an example of DailyBackups? : Changed lines 132-133 from:
Test 2 to:
/home/Users Users 365 Here is an example of WeeklyBackups? : /home/Outlook Outlook 52 /home/Mp3 Mp3 52 /home/Photos Photos 52 Here is an example of MonthyBackups? : /home/Utl Utl 12 /home/Backup Backup 12 /etc Etc 12 /home/scripts Scripts 12 7. Step 3 : Add cron jobs to schedule the backupsCreate the crontab fileCreate the /etc/crontab file : 0 4 1 * * /home/scripts/backup.sh /home/scripts/MonthlyBackups | nail -s "Monthly backup status" myemail@myisp.fr 0 4 1 * * /home/scripts/backup.sh /home/scripts/WeeklyBackups | nail -s "Weekly backup status" myemail@myisp.fr 0 4 * * * /home/scripts/backup.sh /home/scripts/DailyBackups | nail -s "Daily backup status" myemail@myisp.fr
Add a script to load correctly the crontab file at startupThe issue is that the cron will not load correctly the /etc/crontab file at each startup. Create /etc/init.d/_configure_cron.sh :
#! /bin/bash
# load the relevant cron file
BIN_CRONTAB="/usr/bin/crontab";
CFG_CRONTAB="/etc/crontab";
OK=0;
KO=1;
if [ ! -e "$BIN_CRONTAB" ]; then
{
echo "Missing $BIN_CRONTAB";
exit $KO;
}
elif [ ! -e "$CFG_CRONTAB" ]; then
{
echo "Missing $CFG_CRONTAB";
exit $KO;
}
else
{
$BIN_CRONTAB -u root $CFG_CRONTAB;
$BIN_CRONTAB -l
}
fi;
exit $OK;
8. Step 4 : Configure the mail sendingEdit the /etc/ssmtp/ssmtp.conf : # # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # The person who gets all mail for userids < 1000 root=root # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and you mailhub is so named. mailhub=smtp.myisp.fr # Where will the mail seem to come from? #rewriteDomain=localhost.localdomain # The full hostname hostname=myisp.fr
8. Step 5 : Reboot and check that everything is okReboot the slungsync reboot Check cron jobscrontab -l Check the scripts cd /home/scripts
backup.sh DailyBackups?
If necessary, check the backup.sh scriptcd /home/scripts backup.sh /home/Outlook Outlook 12 June 10, 2008, at 11:37 AM
by --
Changed line 3 from:
There are many others procedures, each of them describing a different procedure fitting a particular case.\\ to:
You can find many others procedures in this Wiki, each of them fitting a given context. Changed lines 58-59 from:
5 : Step 1 : Backup scriptto:
5. Step 1 : Backup scriptDeleted line 68:
[@ Deleted line 69:
@] June 10, 2008, at 11:35 AM
by -- Creation
Added lines 1-72:
1. GoalThere are many others procedures, each of them describing a different procedure fitting a particular case. My context
The challenge
My requirements
2. An overview of the solutionAll my requirements all together could seem insane. The idea is the following (thanks to all the guys that proposed that idea on Internet) :
The rest is only scripting... 3. PrerequisitesI tested this procedure with my Linksys NSLU2, with Openslug 2.7 beta. You need some optware packages already installed : ipkg update ipkg install bash to have a real scripting capability ipkg install cron to schedule the backups ipkg install mailx to receive the result of the backup by mail ipkg install nail ipkg install ssmtp ipkg install rsync to ease the backup 4. Overview of the procedure5 : Step 1 : Backup scriptCreate a script file called backup.sh in /home/scripts'' : Test 1 Test 2 |