Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ############################################################################
- # Local Vars
- wwwroot='/www';
- backupdir='/mnt/cymbackup';
- tempdir='tempback';
- backupname='cymsuite';
- dbuser='root';
- dbpass='g0l1ath';
- workdir="${wwwroot}/${tempdir}";
- # Database Names
- db[0]='Ophelia';
- db[1]='Janus2';
- db[2]='Titan';
- # Website Names
- dir[0]='Ophelia';
- dir[1]='Hydra';
- dir[2]='Oberon';
- dir[3]='Titan';
- dir[4]='Mimas2';
- ############################################################################
- # Backing up all the changing databases from array
- echo "";
- echo "Backing up databases";
- for element in $(seq 0 $((${#db[@]}-1)))
- do
- echo "Dumping: ${db[$element]}";
- outdir="${workdir}/${db[$element]}.sql";
- mysqldump -u $dbuser -p$dbpass ${db[$element]} > $outdir;
- gzip $outdir;
- done
- ############################################################################
- # Backing up all the changing websites from array
- echo "";
- echo "Backing up working directories";
- for element in $(seq 0 $((${#dir[@]}-1)))
- do
- tar -C $wwwroot -czf $workdir/${dir[$element]}.tgz ${dir[$element]};
- echo ${dir[$element]};
- done
- ############################################################################
- # Moving the backup to backup server
- echo "";
- echo "Condensing into one archive and copying it to backup dir ${backupdir}";
- tar -C $wwwroot -czf ${backupdir}/${backupname}.tgz $tempdir;
- echo "";
- echo "Process completed";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement