I want to download backup archives from one server to another. The server has a script that delivers the latest backup archive, the file has specific name for each date. I want wget to preserve that name.
When I run:
wget -q --content-disposition 'http://server.example.com/get/latest'
it does just what I want. I can also download the file with a browser.
However, when I put this in a shell script and try running it as cron job nothing happens. I don't see any errors in /var/log/syslog.
Here's the whole shell script:
#!/bin/sh
wget -q --content-disposition 'http://bkp.www1.linux.local/get/latest'
I also tried #!/bin/bash, same result.
What am I doing wrong?
Regardless of where the program you execute resides on the filesystem, the current working directory of the program when cron runs it will be the user's home directory. If you access files in your program, you'll need to take this into account if you use relative paths, or (preferably) just use fully-qualified paths everywhere, and save everyone a whole lot of confusion."* in other words since you did not specify differently wget will download to your home directory.
– HBruijn Aug 05 '16 at 06:12