RabbieBurns Posted July 30, 2008 Posted July 30, 2008 (edited) i have a cron script that tars up some stuff to a tar file that appends the days date to the filename, and then uploads it offsite tar -cf backup_`date +%Y-%m-%d`.tar /home perl ftpput.pl --user=username --pass=password7 --dir=backup --binary --server=ftp.backup.com backup_`date +%Y-%m-%d`.tar Works great, uploads fine However on another location, Im trying to grab that file, and extract it, but wget doesnt seem to like the date variable and comes back with a 404 wget http://wwww.backup.com/backup_`date+%Y-%m-%d`.tar 02:28:09 ERROR 404: Not Found. Is there any way of using wget with a date variable like that? (wasnt sure to post this in linux or scripting forum so plz move if needed) Edited July 30, 2008 by RabbieBurns
kmount Posted July 30, 2008 Posted July 30, 2008 I hit this kind of hurdle too and found it easier (read: saner) to use sftp for security and because you can script in a job. I'll have a think on the wget one this morning.
kmount Posted July 30, 2008 Posted July 30, 2008 Ah, having looked at it, your wget is incorrectly laid out for the date. (needs a space between date and +). wget http://wwww.backup.com/backup_`date +%Y-%m-%d`.tar Works. Also worth bearing in mind, if you're running/grabbing back ups over timezones/midnight be careful of the change of date! Kept me amused for a few hours working that one out. 1
ahuxham Posted July 30, 2008 Posted July 30, 2008 wget -c Don't forget the -c (valuable in regards to lost packets and download stopping) Could CTRL+C a long download with the -c switch, retype the exact command, and it will continue from where it left off! 1
Geoff Posted July 30, 2008 Posted July 30, 2008 Variable expansion has nothing to do with wget. It is done by the shell before the parameter (in this case a url) is passed to the program being called (in this case wget). I suggest you replace the wget command with an echo, then you can inspect the variable expansion and check that it is correct. If there's still something strange going on, add a 'set +x' to the beginning of your script and observe the output when you run the script manually. 1
RabbieBurns Posted July 31, 2008 Author Posted July 31, 2008 Thanks kmount for pointing out the missing space, and geoff for clarifying things, but it has taken me till now to realise i put wwww instead of www and that was another reason why it wasnt working All working now No timezones to worry about, but thanks for the tip.
kesomir Posted July 31, 2008 Posted July 31, 2008 rsync and rdiff-backup 4tw Take a look at those, they rock. (I know it's a troll pic, but it DANCES!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now