solarian Posted March 24, 2005 Report Share Posted March 24, 2005 (edited) Hey! I have a remote server and it on request generates a gzip backup file to download. I can download it using wget --http-user=USER --http-passwd=PASS http://URL/sql.gz I don't have any problems there, but I want to make the process more automated. I need: 1. Make the download scheduled (say, each day at 12:00am) 2. Upon downloading the filename is changed, the current date is added (sql-DATE.gz) 3. The downloading is done to a particular directory on my hdd (obvious) p.s. I have no knowledge in programming, so don't advice me to write my own program to do this. Maybe there is a ready code to do this? p.s. I know that there is the d4x program, but it has no options for the renaiming of files (not that I know of anyways). I need that renaiming, so that if the latest download is broken, it doesn't damage my already downloaded backup file. However the program has a line "execute command", maybe you can tell me what would be a syntax for filename.gz -> filename-DATE.gz p.p.s. using d4x is not really what I'd prefer. It's an X program and it uses valuable resources, besides I wouldn't like my backups to be dependant on an X program, a simple few line script would be much nicer, the problem is that I don't know how to make it. thanx in advance if someone helps!! edit: I found out the filename change! :) mv filename.gz filename-`date +%m%d%y_%H%M`.gz now.. how to make it scheduled.. Edited March 24, 2005 by solarian Quote Link to comment Share on other sites More sharing options...
Guest anon Posted March 24, 2005 Report Share Posted March 24, 2005 Or, if you just want two copies (current and previous ) you could run something like: rsync -ab --suffix=.bak /remote_url/file_name /destination/file_name Use cron to schedule it, or use the scheduled jobs module in Webmin. Quote Link to comment Share on other sites More sharing options...
solarian Posted March 24, 2005 Author Report Share Posted March 24, 2005 thanx for the advice! Quote Link to comment Share on other sites More sharing options...
Hirogen2 Posted March 24, 2005 Report Share Posted March 24, 2005 1. Make the download scheduled (say, each day at 12:00am)2. Upon downloading the filename is changed, the current date is added (sql-DATE.gz) 3. The downloading is done to a particular directory on my hdd (obvious) now.. how to make it scheduled.. Make your own cron script. /home/user/download_and_process: #!/bin/bash -e wget http://blah/sql.tgz; mv sql.tgz sql-`date "+%Y-%m-%d_%H%M"`.tgz; And add this to your crontab (`crontab -e`): 0 12 * * * /home/user/download_and_process Finished. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.