|
Create a directory /home/winserver. Created by root user. No permission changes needed root:root is ok.
The following is for CentOS servers (RHE flavored). Replace [value] with appropriate values for your situation.
Archive script runs after backup below
Archive script
echo 'Mounting Windows Server';
mount -t cifs -o username=[username],password='[password]',rw,uid=500,gid=500 //[winserverIP]/[folder] /home/winserver;
echo 'Archiving sqls and tars - be patient!';
echo 'Archiving sqls ...';
cp /home/backup/*-$(date +%Y%m%d).sql /home/winserver;
echo 'Archiving tars ...';
cp /home/backup/*-$(date +%Y%m%d).tar /home/winserver;
echo 'Archiving completed. Listing files.';
ls /home/winserver;
echo 'Unmounting Windows Server';
umount /home/winserver;
echo 'If no files found, unmount OK!';
ls -l /home/winserver;
echo 'Done Archiving.';
Backup Script
cd /home/backup;
tar -cvf /home/backup/moodle-$(date +%Y%m%d).tar /var/www/moodledata /var/www/html/moodle;
mysqldump -u [mysql-user] -p[password] [db] > /home/backup/[db]-$(date +%Y%m%d).sql;
echo 'Done ... listing ...';
ls -l /home/backup;
The above scripts are used on production servers. Dis-calmer (author did spell it correctly): your mileage might vary. Author not responsible for it's use or mis-use, etc..
NOTE: the scripts could be converted to something 'Windows'. If anyone does, please share back!
|