Jump to content

scheduled downloads [solved]


Recommended Posts

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!! :thanks:

 

 

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 by solarian
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...