Setting crontab to pull database

Reply

Join Date: Jun 2008
Posts: 25
Reputation: Aigini is an unknown quantity at this point 
Solved Threads: 0
Aigini Aigini is offline Offline
Light Poster

Setting crontab to pull database

 
0
  #1
Oct 28th, 2009
I'm working in a location with a physical server, and the company I am working for is in a different location, and has a cloud server with a different address.

Database backups work using automysqlbackup script in the cloud server also. But the database backups that I want to pull from the cloud server is quite huge and cannot be exported to my local server using phpMyAdmin.

So can I use the scp command in the crontab to pull the backed up database daily into my local server? , i.e :

* * * * * scp -r root@cloudservername:/backups/databasename.sql.gz
Thanks.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 26
Reputation: Cronless is an unknown quantity at this point 
Solved Threads: 2
Cronless Cronless is offline Offline
Light Poster
 
0
  #2
Oct 28th, 2009
Not sure if the cron environment or the crontab itself will support the use of scp in that shell the way you want to use it. I'd suggest pulling the scp command out into some script file and then running the script, after you explicitly set any required or assumed environment variables. Something like:
* * * * * /path/to/script.sh
where /path/to/script.sh is your new script and inside it, you have:
#!/bin/bash
export ENVIRONMENT_VAR=foo
#whatever else you need
scp -r root@cloudservername:/backups/databasename.sql.gz > /tmp/output.log
~~ Free Cron Jobs - Online Cron Service ~~
Best place to run your PHP Cron Jobs
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 25
Reputation: Aigini is an unknown quantity at this point 
Solved Threads: 0
Aigini Aigini is offline Offline
Light Poster
 
0
  #3
Oct 29th, 2009
What does export ENVIRONMENT_VAR=foo do, and what do I actually add in #whatever else you need?
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the *nix Software Forum
Thread Tools Search this Thread



Tag cloud for *nix Software
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC