Automatic backups help


#1

I want to backup my files and folders and found DH wiki(http://wiki.dreamhost.com/index.php/Automatic_Backup) very helpful. I created backups and backups/archives directories and under backups I uploaded the domain.sh script I saved in notepad using UTF-8 format and save all files which has the following codes:

#!/bin/bash
suffix=$(date %y%m%d)
tar -cf /home/username/backups/archives/domain.com.$suffix.tar /home/username/.snapshot/nightly.0/domain.com

And I tested using PuTTY, I started running commands like

cd backups which was good.

But when I gave ./domain.sh it says

./domain.sh
: No such file or directoryne 1: #!/bin/bash
tar: Removing leading `/’ from member names

Following the guide I put my real domain instead of domain mentioned above. domain.com and username I used my own as per the guide. Still I’m getting the error.

Once I set up the above correctly I will add cronjobs task as well.

Please help me. Thank you.

EDIT 1:
I went inside the backups/archives after commanding from PuTTY and found that tar file is there. domain.060712.tar but when I tried to download using Filezilla FTP I cannot download, it says

domain.060712 no such files or directory. YOu can see the extension is missing too.


#2

Notepad’s most likely the culprit. Windows editors tend to add extra hidden characters. Use pico or nano while logged in with PuTTY.

-Scott


#3

Ya, probably the easiet thing to do at this point is to open up each of your scripts in nano, edit any weirdness out and save. To do this give the command
nano -w domain.sh

when you’re done press ctrl and o at the same time to save and then ctrl-x to exit. See if the script will now run.

I’ll have to work on making those directions again. shakes his head

–Matttail
art.googlies.net - personal website


#4

Ok, I downloaded nano-1.2.3.tar.gz and wanted to install in my computer so that I can use the editor. But I’m clueless about how to install the editor in my system though I can see ‘How to compile and install nano’ at http://www.nano-editor.org/dist/v1.2/README

My OS is Windows XP Home service pack 2 enabled.

Thanks for your help again.

Edit 1:
I tried running the following command in PuTTY but it says no says no such files or directory, the tar file itself was not called in.

tar zxvf nano-1.2.5.tar.gz
cd nano-1.2.5
./configure
make
make install


#5

sorry. nano should be run from putty and it’s already installed. Nano an pico are both command line text editors. Like notepad, but running on your DH server. it should go something like this:

launch putty, log in.
cd backups
nano -w domain.sh

that will bring up the file called domain.sh in your backups directory. Now use the editor to make sure there’s nothing wonky with your script and save it. you can use the arrow keys to move around, and such as you would normally. then fress crtl-o to save and crtl-x to exit as I mentioned above. After you’ve done this try running the scripts again as mentioned in the wiki to test and see if it’s working now.

–Matttail
art.googlies.net - personal website


#6

Use a Hex editor to remove the extra  characters generated by notepad.

A free Hex editor http://www.hhdsoftware.com/Products/home/hex-editor-free.html