Backup Scripts for 1and1 and Others

1and1.com is the hosting provider I’ve been using and recommending to others for many years.  They provide adequate service on a very complete product offering that is inexpensive.  So long as you can either resolve issues yourself as their technical support is not what I would call strong, they are a great option.  (Does that spell out an endorsement with caution well enough?)

One thing I’ve come up with is a modification to a backup script that if you are using a Linux system at 1and1 and have access to making crontabs, you can have daily, weekly and monthly database backups stored on the server, emailed to you, or both.  I got this script from a project on SourceForge and modified it to work with 1and1.

  1. 1and1-backup-script  Download this zip archive and unzip it.  You’ll find a shell script and an empty folder called “backups” within it.
  2. Open the backup.sh file in a simple text editor — I use my SFTP tool Transmit for this, too – and enter your database information and change the “changeme@email.com” address to yours or make it empty for no email.  (A dedicated Gmail account would be useful here, too.)
  3. Save the file and upload it and the empty backups directory to your root directory of your 1and1 account. Be sure to set the permissions of your shell script to something that is executable.  If you have configured your domain(s) on your account to point to a subdirectory, this will also keep the shell script and backups from being accessible by a web browser.  More on this simple security hack in the future.
  4. Using a command line tool such as Terminal on a Macintosh, login to your 1and1 account using your SSH credentials.  1and1 has good online help here.
  5. Once you’ve logged in, it’s time to setup the crontab that will run the backup.  Enter “crontab -e” to enter the crontab editor.
  6. You’ll be in the program vi after entering this prompt.  To enter a new line, you’ll need to type “i” to INSERT a line.
  7. I have my backup run at 3:30AM on the server every day of the year.  Here’s the line to type to do the same:
    30 03 * * * sh ./backup.sh >> /dev/null 2>&1
  8. Press the escape key to exit Insert mode and then type press the shift key and type “zz” to exit vi.  You’ll get a prompt about your crontab being written (or modified) at this point.
  9. To view the crontab without editing it, you can type “crontab -l”

If you have multiple databases to backup, you can modify the name of the shell script and backup directory easily enough.  I’ve been using this backup script with my website and with client websites for years.  It has never failed me and has saved my clients several times.  Many thanks to the original authors of this useful open source script.

 

4 thoughts on “Backup Scripts for 1and1 and Others

  • August 3, 2013 at 9:12 AM
    Permalink

    Absolutely perfect instruction. Thank you.

    Reply
  • May 5, 2017 at 1:07 PM
    Permalink

    Tried so many things to get this working on a Linux account at 1&1 where I do not have any root access. This was the first one that worked — and I got it working in under 15 minutes. Thanks so much!

    Reply
    • May 5, 2017 at 1:22 PM
      Permalink

      I’m glad it helped you!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *