The script will generate the following folders:
/storage/backup/0/storage/backup/1
/storage/backup/2
/storage/backup/3
/storage/backup/4
So if for example the day of month is 12, then backup is taken in folder /storage/backup/2 and so on.
backup.sh
#!/bin/ksh
BackupParentDir=/storage/backupbackupid=`date | awk '{print$3%5}' `
echo backupid=$backupid
BackupDir=$BackupParentDir/$backupid
echo Backup directory = $BackupDir
rm -rf $BackupDir
mkdir $BackupDir
#BackupDir is ready for use now, and you can copy what ever needed to this folder
#Add the rest of your backup logic
No comments:
Post a Comment