Actions
Backup Strategies on cwyrnd3-server » History » Revision 1
Revision 1/2
| Next »
chin-yeh, 07/06/2011 09:44 AM
Backup Strategies on cwyrnd3-server¶
Backup the following folder or files:- /opt/**
- /data/**
- /var/ecosway
- run daily at 0850
- Server: cwyrnd3-server (IP: 192.168.2.13)
- User: root
- Folder: /data_bak/cwyrnd3-server
- Server: cwydb1 (IP: 192.168.2.68)
- User: support
- Connection Method: SCP with password-less configured
Scripts:
#!/bin/bash # # Backup files to remote server. # # Must configure the password-less login between local and remote server. # # temp workspace tmp_ws=/tmp/backup # today's date today_dt=$(date +%Y-%m-%d) # files to be backup # application, data, log and etc. app_dir=/opt data_dir=/data log_dir=/var/ecosway # remote backup destination remote_ip=192.168.2.68 remote_user=support remote_dest_dir=/data_bak/cwyrnd3-server # compress the files echo "Compressing $app_dir" tar -cvzf ${tmp_ws}/${today_dt}.applications.tgz ${app_dir} # compress data files echo "Compressing $data_dir" tar -cvzf ${tmp_ws}/${today_dt}.data.tgz ${data_dir} # compress log files echo "Compressing $log_dir" tar -cvzf ${tmp_ws}/${today_dt}.log.tgz ${log_dir} echo "Compression is completed." # transfer files to remote server echo "Transferring file(s) to $remote_ip:$remote_dest_dir" scp /tmp/backup/${today_dt}*.tgz ${remote_user}@${remote_ip}:$remote_dest_dir echo "Transfer is completed" # remove the temp files echo "Remove temp files..." rm -f ${tmp_ws}/${today_dt}*
Updated by chin-yeh over 13 years ago · 1 revisions