944,051 Members | Top Members by Rank

Ad:
Oct 28th, 2009
0

Setting crontab to pull database

Expand Post »
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 :

Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Aigini is offline Offline
25 posts
since Jun 2008
Oct 28th, 2009
0
Re: Setting crontab to pull database
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
Reputation Points: 14
Solved Threads: 2
Light Poster
Cronless is offline Offline
29 posts
since Sep 2009
Oct 29th, 2009
0
Re: Setting crontab to pull database
What does export ENVIRONMENT_VAR=foo do, and what do I actually add in #whatever else you need?
Reputation Points: 10
Solved Threads: 0
Light Poster
Aigini is offline Offline
25 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Linux Applications and Software Forum Timeline: Cron job problems
Next Thread in Linux Applications and Software Forum Timeline: cron job not running for big time intervals





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC