# # # # # # # # # #从ftp服务器上的/home/data to local/home/databackup####
The code is as follows |
Copy Code |
#!/bin/bash ftp-n<<!
Open 192.168.1.171
User Guest 123456
Binary
Cd/home/data
Lcd/home/databackup
Prompt
Mget *
Close
Bye
! |
2. FTP Automatic login upload file.
The code is as follows |
Copy Code |
### #本地的 the/home/data#### on/home/databackup to FTP server #!/bin/bash ftp-n<<!
Open 192.168.1.171
User Guest 123456
Binary
Hash
Cd/home/data
Lcd/home/databackup
Prompt
Mput *
Close
Bye
! |
3. FTP automatic login to download a single file.
The code is as follows |
Copy Code |
### #ftp服务器上下载/home/data/a.sh to local/home/databackup#### #!/bin/bash ftp-n<<!
Open 192.168.1.171
User Guest 123456
Binary
Cd/home/data
Lcd/home/databackup
Prompt
Get a.sh a.sh
Close
Bye
|
!
4. FTP automatically login to upload a single file.
The code is as follows |
Copy Code |
### #把本地/home/databachup/a.sh up Ftp/home/databackup #!/bin/bash ftp-n<<!
Open 192.168.1.171
User Guest 123456
Binary
Cd/home/data
Lcd/home/databackup
Prompt
Put a.sh a.sh
Close
Bye
! |
As a friendly reminder, we'll save the shell script above as a file, and then execute it with crontab.
Some examples of rontab files:
The example above,
* * * * */usr/local/etc/rc.d/lighttpd restart
, represents 21:30 restart Apache per night. The example above,
4 1,10,22 * */usr/local/etc/rc.d/lighttpd restart
, represents 4:45 restart Apache for 1, 10, and 22nd per month. The example above for
1 * * 6,0/usr/local/etc/rc.d/lighttpd restart
represents 1:10 restart Apache per Saturday and Sunday. The example above,
0,30 18-23 * * * */usr/local/etc/rc.d/lighttpd restart
, indicates that Apache is restarted every 30 minutes between 18:00 and 23:00 every day. The example above in
0 * * * 6/usr/local/etc/rc.d/lighttpd Restart
indicates that the 11:00 PM restarts Apache every Saturday.
* */1 * * */usr/local/etc/rc.d/lighttpd restart