Automatic Backup - Syntax issues?

Automatic Backup - Syntax issues?

Posted by: lwwjr
Posted on: 2006-07-09 06:35:00

I followed matttail's great write-up on automatic backups, but I'm getting an error when I execute the bash:

: No such file or directorycd: /home/larrywhitt/.snapshot/nightly.0/

If I copy and paste that cd command directly, I find the nightly.0 directory without any trouble. Here's my complete script:

#!/bin/bash
suffix=$(date +%y%m%d)
cd /home/larrywhitt/.snapshot/nightly.0/
tar -cf /home/larrywhitt/backups/archives/whisperinghope.$suffix.tar whisperinghope.org/

I'm not familiar with bash scripts, so I hope I'm just doing something stupid.




Re: Automatic Backup - Syntax issues?

Posted by: kchrist
Posted on: 2006-07-09 08:54:00

Add this as the second line of the script, just below #!/bin/bash:

PATH="$HOME/bin:/usr/local/bin:/usr/bin:/bin"

Re: Automatic Backup - Syntax issues?

Posted by: matttail
Posted on: 2006-07-09 09:01:00

From your errror message alone I would have guess you had "cd" in your bash script twice, but that's obviously not the case. use the program nano to open then file on your server (from ssh) as such:
nano -w domin.sh
and put an extra line between the $suffix line and the cd one. Press ctrl and o at the same time to save and ctrl and x at the same time to exit. Then try running the command and see if you still get the error.



--Matttail
art.googlies.net - personal website

Re: Automatic Backup - Syntax issues?

Posted by: lwwjr
Posted on: 2006-07-09 09:13:00

That did it! Thanks for the help.

Tags: tar cfsuffixbackupssnapshotcopy and pasteautomatic backupsyntaxstupidhopeorg