• Services
    • Web Hosting
    • Reseller Hosting
    • VPS Hosting
    • Dedicated Hosting
  • Domains
  • Features
  • Company
    • About Us
    • Server Locations
    • Affiliates
    • Company Blog
  • Support
  • Client Login
  • Services
    • Web Hosting
    • Reseller Hosting
    • VPS Hosting
    • Dedicated Hosting
  • Domains
  • Features
  • Company
    • About Us
    • Server Locations
    • Affiliates
    • Company Blog
  • Support
  • Client Login
Home/Article/Linux/Automating FTP Backups in Linux

Automating FTP Backups in Linux

Written by VernalWeb
April 2, 2018
This is a simple backup script for Linux dedicated servers to back up a specific directory and all of it’s sub directories and save them in your backup FTP storage, organized by date.
1. Download lftp using the command: yum install lftp (CentOS) or apt-get install lftp (Debian and Ubuntu)
2. Have a directory in the root of the back up FTP named “backup“
3. Modify the script below with your credentials and settings:
#!/bin/bash
### FTP login credentials below ###
FTPU=”FTP-Username”
FTPP=”FTP-Password”
FTPS=”FTP-IP-Address“
NOW=$(date +”%d-%m-%Y”)
### local directory to backup ###
FILE=”/DIR-to-Backup“### Login to remote server ###
### No need to edit any of the fields below ###
### Default DIR is backup ###
lftp -u $FTPU,$FTPP -e “cd backup;mkdir $NOW;cd $NOW;mirror -R $FILE /backup/$NOW;quit” $FTPS

4. Save the script as backup.sh and run “chmod +x ./backup.sh” to make into an executable.
5. run the back up script by typing ./backup.sh
The script can be scheduled as a cron job for automated backups on a specific frequency.

We hope this tutorial helps you find the perfect solution. If your like our tutorials, definitely you’ll love our support. All VernalWeb hosting plans include 24/7 support from our amazing inhouse support staff. Check out our web hosting plans and have your website migrated today!

Was this helpful?

Yes  No
Related Articles
  • How do I order Extra IPs For My VPS/Dedicated?
  • How to Use KVM with the Intel Core i5 4570
  • How to Change the Default SSH Port (Linux / Ubuntu / Debian)
  • How to Change the Default SSH Port (Linux / CentOS)
  • How to whitelist an IP Address in ConfigServer Firewall (CSF)
  • Troubleshooting/Reporting Network and Packet Loss Issues

Didn't find your answer? Submit Ticket

Latest Articles

  • How to show Hidden Files (.htaccess) in cPanel File Manager
  • Setup a Domain Redirection in cPanel
  • Create a MySQL Database and a User from cPanel
  • Remove page extensions using .htaccess
  • Cron Job Usage & Policy
  • © 2014 - 2025 VernalWeb. All rights reserved.