CRON Job to copy database and replace existing database


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CRON Job to copy database and replace existing database
# 1  
Old 10-22-2012
CRON Job to copy database and replace existing database

I have a reseller account with hostgator, which means i have WHM and Cpanel. I have set up a staging environment for one of my wordpress installations (client website), which is essentially sitting at staging.domain.com (live site is at domain.com). The staging website is a complete copy of the live website and utilises a different database.

The idea behind this is to test all new module updates / wordpress updates prior to releasing to the live website, however.. Content can chance on the live website without the staging website receiving the updates (want to use this as a backup also.)

What I want to do is set up a daily CRON job to copy the database from one hosting account to and replace another database. (tables and all) on a daily basis. I figure this will only be possible at host manager level (WHM) as a cpanel user will not have permission to interface between 2 different accounts.

Does anyone know how to do this? Do I need to create a PHP script to run every day? What would that look like.. Sorry I know its a big ask, im just clueless at this level.
# 2  
Old 10-22-2012
Wouldn't it be easier to duplicate/replicate the database with database means?

I don't know which DB you use (probably mySQL), but all DB softwares i know of allow to create a complete dump of its contents. Create such a dump, transfer it to the staging-machine (simple file-transfer) and again use the DB mechanisms to update your DB there.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to implement new CRON job or modify the existing one in MDM PROD in coming days, which will sen

Need to implement new CRON job or modify the existing one in MDM PROD in coming days, which will send email of SQL statement running from past 1 minute.Currently there is one CRON job in PROD, which send below email. there is one cron job which send email, when there is long running... (0 Replies)
Discussion started by: dampu
0 Replies

2. Shell Programming and Scripting

Problem with backup and copy a database

Hi, I have many servers distributed on my customer locations all servers has MYSQL database. I want to backup database for each server on server at my location using scheduler. So I create Shell script file to backup and copy the database file from customer server to my server as... (3 Replies)
Discussion started by: amsbas
3 Replies

3. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

4. Solaris

redirect solaris database from linux database..

hi.. i have a need .. my php runs on my linux redhat box with mysql.. i want my php code to refer another mysql database which is in solaris 10 x86... can u tell me the procedure .. how it can be done through php .. sorry am new to php... is it possible to redirect from linux mysql to... (7 Replies)
Discussion started by: senkerth
7 Replies

5. Shell Programming and Scripting

How to write cron job for calling sql function database is postgres

Hi, Please help me to write cron job for calling sql function daily. I have Postgres database. (1 Reply)
Discussion started by: kulbhushan
1 Replies

6. Shell Programming and Scripting

Sample ksh script for copy the data from excel to database table ?

Hi All, I need to convert the data from excel to database table in sybase. Please provide some sample script.. thanks, Royal. (1 Reply)
Discussion started by: royal9482
1 Replies

7. UNIX for Dummies Questions & Answers

how to run cron job to truncate database table

hi i'm a bit stuck trying to find the correct syntax in order to run a cron job which just truncates all info from a single table in my database i have a main database - db1 and i have a table in that database - userips i wish to create a cron job that truncates or removes all the info... (9 Replies)
Discussion started by: wingchun22
9 Replies

8. Shell Programming and Scripting

PERL: Read from Database and copy

I have a microsoft access database with anout 220 lines. theres a question and 4 option awnsers and only ones correct which is also listed in th database. Is there any perl script that will copy and the lines from the database and put into a .asp website ? (2 Replies)
Discussion started by: perleo
2 Replies

9. UNIX for Dummies Questions & Answers

Crontab job for exporting a Oracle database

Could someone give me a hint how to get or write such a job ? I want to schedule a Oracle export using the crontab, I really do not know how to do this. Concreet: How do I write such a script ? Thanks for your help. (1 Reply)
Discussion started by: c.d.israel
1 Replies
Login or Register to Ask a Question