Back up simple shell scripts for remote server files
Source: Internet
Author: User
Backup Remote server file simple shell script assume there are two servers: 19216801 original server 19216802 backup server implementation function: compress the opttestcms directory file on 19216801 to the backup server. The shell script is as follows: [plain]! The simple shell script for backing up remote server files assumes that there are two servers: 192.168.0.1 original server 192.168.0.2 backup server implementation: compress the/opt/test/cms/directory file on 192.168.0.1 to the backup server. The shell script is as follows: [plain] #! /Bin/sh time1 = $ (date "+ % Y % m % d % H % M % S ") cd/data/sys_bak mkdir $ time1 # bak ssh 192.168.0.1 tar-czvf/opt/test/test2/cms1_time1.tar.gz/opt/test/cms/scp-P 22-r root@192.168.0.1: /opt/test/test2/cms1_time1.tar.gz/data/sys_bak/$ time1 ssh 192.168.0.1 rm-f/opt/test/test2/cms1_time1.tar.gz
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