The first post for this year…
Simple FTP backup script
# nano backup_script |
Add next lines and save.
#!/bin/bash DM=$(date +"%Y-%m-%d") tar -Pzcf /backup/backup_$DM.tar.gz /backup/some_dir/ cd /backup ftp -nv <<EOF open 192.168.1.2 user ftp_username ftp_password bin put backup_$DM.tar.gz quit EOF echo -e "FTP backup done!" |
Make it executable with
# chmod +x backup_script |
Of course, you need to replate ftp_username and ftp_password with valid username and password. Also, IP address should be replaced with your ftp server IP address.
Add this script to cron (for example once per day at 4:00AM)