CentOS mounts Windows shared folders and automatically backs up.

Source: Internet
Author: User

#mkdir/mnt/airfreightdb
#mount-T cifs-o username=admin , Password=xxxxxxxx //< Span style= "Background-color: #00ff00" >192.168.42.5/appserv /mnt/ Airfreightdb
#ll/mnt/airfreightdb
#mkdir/mnt/sdb1/ Airfreightdb
#cd/mnt/sdb1/airfreightdb
#vi airfreightdb.sh
************************************

date= ' DATE +%y-%m-%d '
tar-cvzf/mnt/sdb1/airfreightdb/airfreightdb.$ date.tar.gz /mnt/airfreightdb
********************************************************************
#sh airfreightdb.sh
ll-h   #使用 "-H" parameter, the displayed units are selected according to the size of the file "K", " M "or" G ".


Share 192.168.42.5 's Appserv, shut down Windows Firewall
Go to CentOS,
Set up the Mount folder, mount the AppServer,
Then SDB1 set up Airfreightdb folder, set up SH (set to automatically delete the backup before 7th),
Execute SH
Set up scheduling

****************************************************************
Seven days after test

Automatic deletion of backups before 7th
Rm-f/mnt/sdb1/airfreightdb/' date-d '-7 days ' +%y%m%d '. tar.gz
find/mnt/sdb1/airfreightdb/-type d-mtime +7-exec rm-f

CentOS mounts Windows shared folders and automatically backs up.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.