Cron and auto backups

With all the downtime recently, I’ve prioritized setting up automatic backups for my server.

I’m following these instructions:

However, whenever I try to run the scripts, I get the error:

/bin/sh: /home/myusername/backups/ /bin/bash
: bad interpreter: No such file or directory

I’ve looked into other posts in here related to this, but didn’t find any concrete answers.

Please advise.

try this, from putty use the “cd” command to move into your backups directory:
cd backups/
then open the script with a text editor like nano:
nano -w

If my guess is right nano will say “converted from DOS format” towards the bottom of your screen. Press ctrl-o (both at the same time) to save the file and ctrl-x to exit. Now test the script and see if it runs.

As a side note, could you please let me know what operating system you’re using, how you saved the file on your computer, and how you uploaded it to your server (what program did you use)? A few people have had similiar problems with my little backup script and I’m trying to figure out what I can change in the instructions so that it works for people. Thanks!

–Matttail - personal website

Thank you for your quick and helpful reply!

Your assumptions were correct: I performed the tasks you outlined and the scripts were able to run.

Also, DH support let me know that I could run


to convert the files.

So, now the backups are working, however I get this email whenever is run:

tar: Removing leading `/’ from member names

I found this reference to this same error:

How to avoid getting this error?

That thread goes on to talk about that it’s bad to backup a running MySQL db. Should the DB be locked before it’s dumped?

Lastly, how would you modify the sh scripts to send the backups to another (non-DH) server?


heh, the best way to avoid that error is to not listen to my advice. :wink:
I made a change to the wiki article recently, decided to cut the backup command down to one line, but apparently tar doesn’t like that method as well.

Change your backup scripts from this:

tar -cf /home/user/backups/archives/domain.$suffix.tar /home/user/.snapshot/nightly.0/

to this:
cd /home/user/.snapshot/nightly.0/
tar -cf /home/user/backups/archives/domian$suffix.tar

(that’s two lines, one starting with “cd” the other with “tar”)

I do not believe that there’s any need to shut down or ‘lock’ the database before backuping up that data. I’m fairly certin that a mysql dump is designed to take backups while the DB is running.

[qupte]Lastly, how would you modify the sh scripts to send the backups to another (non-DH) server?[/quote]
Hmm, that’s a fun question. You can either have your DH server send it to your ServerB, or visa versa. It shouldn’t make any difference in speed.
I think what I’d do would be to use sftp to send the files. Basically you’d take the instructions for automatically downloading your files to a linux machine and switch them around a bit to suit your needs. You could also use “scp” to send the files. (I don’t know of any way to send the files if you don’t have sftp or ssh access)

Hope that helps. Thanks for the convert utility, I’ll add a not about that to the wiki.

–Matttail - personal website