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.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Shell Programming and Scripting
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
3. UNIX for Dummies Questions & Answers
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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. Solaris
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
7. Solaris
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
LEARN ABOUT PHP
yaf_config_ini
YAF_CONFIG_INI(3) 1 YAF_CONFIG_INI(3)
The Yaf_Config_Ini class
INTRODUCTION
Yaf_Config_Ini enables developers to store configuration data in a familiar INI format and read them in the application by using nested
object property syntax. The INI format is specialized to provide both the ability to have a hierarchy of configuration data keys and inher-
itance between configuration data sections. Configuration data hierarchies are supported by separating the keys with the dot or period
character ("."). A section may extend or inherit from another section by following the section name with a colon character (":") and the
name of the section from which data are to be inherited.
Note
Yaf_Config_Ini utilizes the >> parse_ini_file() PHP function. Please review this documentation to be aware of its specific behav-
iors, which propagate to Yaf_Config_Ini, such as how the special values of " TRUE", " FALSE", "yes", "no", and " NULL" are handled.
CLASS SYNOPSIS
Yaf_Config_Ini
Yaf_Config_Iniextends
Yaf_Config_AbstractIteratorArrayAccessCountable
Properties
Methods
o public Yaf_Config_Ini::__construct (string $config_file, [string $section])
o public void Yaf_Config_Ini::count (void )
o public void Yaf_Config_Ini::current (void )
o public void Yaf_Config_Ini::__get ([string $name])
o public void Yaf_Config_Ini::__isset (string $name)
o public void Yaf_Config_Ini::key (void )
o public void Yaf_Config_Ini::next (void )
o public void Yaf_Config_Ini::offsetExists (string $name)
o public void Yaf_Config_Ini::offsetGet (string $name)
o public void Yaf_Config_Ini::offsetSet (string $name, string $value)
o public void Yaf_Config_Ini::offsetUnset (string $name)
o public void Yaf_Config_Ini::readonly (void )
o public void Yaf_Config_Ini::rewind (void )
o public void Yaf_Config_Ini::__set (string $name, mixed $value)
o public array Yaf_Config_Ini::toArray (void )
o public void Yaf_Config_Ini::valid (void )
Inherited methods
o abstractpublic mixed Yaf_Config_Abstract::get (string $name, mixed $value)
o abstractpublic bool Yaf_Config_Abstract::readonly (void )
o abstractpublic Yaf_Config_Abstract Yaf_Config_Abstract::set (void )
o abstractpublic array Yaf_Config_Abstract::toArray (void )
PROPERTIES
o $_config
-
o $_readonly
-
EXAMPLES
Example #1
Yaf_Config_Ini(3)example
This example illustrates a basic use of Yaf_Config_Ini for loading configuration data from an INI file. In this example there are
configuration data for both a production system and for a staging system. Because the staging system configuration data are very
similar to those for production, the staging section inherits from the production section. In this case, the decision is arbitrary
and could have been written conversely, with the production section inheriting from the staging section, though this may not be the
case for more complex situations. Suppose, then, that the following configuration data are contained in /path/to/config.ini:
; Production site configuration data
[production]
webhost = www.example.com
database.adapter = pdo_mysql
database.params.host = db.example.com
database.params.username = dbuser
database.params.password = secret
database.params.dbname = dbname
; Staging site configuration data inherits from production and
; overrides values as necessary
[staging : production]
database.params.host = dev.example.com
database.params.username = devuser
database.params.password = devsecret
<?php
$config = new Yaf_Config_Ini('/path/to/config.ini', 'staging');
var_dump($config->database->params->host);
var_dump($config->database->params->dbname);
var_dump($config->get("database.params.username"));
?>
The above example will output something similar to:
string(15) "dev.example.com"
string(6) "dbname"
string(7) "devuser
PHP Documentation Group YAF_CONFIG_INI(3)