need help to automate tasks using shell scripts

Author Message

Alexandre Cunha

Tuesday 25 May 2004 4:56:53 pm

Hello

Im looking to a simple and secure way to download mysql dump from a site made with ezpublish every time i need copy/backup the online database to my local machine.

Want do this using one shell script.

What that shell script need do ?
- receive some paramaters (remote server, remote database name, localdatabase name, ...)
- connect to the remote server,
- get the database dump,
- zip/tar and download it,
- then on my local host, unzip/unpack and override the dump to a local database.

All connect/transfer tasks using ssh/scp.

Use linux on remote server (host company) and win + cygwin on my local machine.

I what extend this idea to update the design/templates folders of my sites:
- local zip/tar,
- copy to remote server in a secure way,
- unzip/untar on remote,
- replace the changed/new files.

I need some help and if possible, examples.
I have knowledge todo some basic tasks (use ssh, scp, get mysql dump, untar) but can build the complete solution.

So, if other users use scripts and other tecniques to update remote/local servers (templates, databases) I really apreciates sugestions and samples.

Thanks

axel

http://AlexandreCunha.com

Egil Fujikawa Nes

Sunday 06 June 2004 11:57:34 pm

Hi

I assume that you are using mysql database. The easiest way to do this is to have your remote server as a master server and the local server as a slave server. This will give you the possibility to have a “fresh” slave database all the time, but you will not be able write anything to the local (slave) database. More information about how to configure can you find here: http://dev.mysql.com/doc/mysql/en/Replication.html

To move templates and other files I would recommend rsync (http://samba.anu.edu.au/rsync/) to do this job. Rsync is doing this job for me today.

Egil Fujikawa Nes
http://www.webdeal.no

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:12:19
Script start
Timing: Jan 18 2025 15:12:19
Module start 'layout'
Timing: Jan 18 2025 15:12:19
Module start 'content'
Timing: Jan 18 2025 15:12:20
Module end 'content'
Timing: Jan 18 2025 15:12:20
Script end

Main resources:

Total runtime0.6643 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 589.1563152.6406
Module start 'layout' 0.00450.0033 741.796939.4766
Module start 'content' 0.00780.6550 781.2734492.1797
Module end 'content' 0.66280.0016 1,273.45318.1250
Script end 0.6643  1,281.5781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4625160.0002
Check MTime0.00130.1885160.0001
Mysql Total
Database connection0.00070.100310.0007
Mysqli_queries0.621793.5792540.0115
Looping result0.00050.0748520.0000
Template Total0.636795.820.3183
Template load0.00190.292920.0010
Template processing0.634795.542420.3174
Template load and register function0.00020.030910.0002
states
state_id_array0.00080.119810.0008
state_identifier_array0.00090.140020.0005
Override
Cache load0.00160.2462300.0001
Sytem overhead
Fetch class attribute can translate value0.00060.089520.0003
Fetch class attribute name0.00130.197920.0007
XML
Image XML parsing0.00020.033220.0001
class_abstraction
Instantiating content class attribute0.00000.001120.0000
General
dbfile0.00060.0902100.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs