Forums / General / need help to automate tasks using shell scripts

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

eZ debug

Timing: Jan 18 2025 10:35:04
Script start
Timing: Jan 18 2025 10:35:04
Module start 'content'
Timing: Jan 18 2025 10:35:04
Module end 'content'
Timing: Jan 18 2025 10:35:05
Script end

Main resources:

Total runtime0.9457 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0089 588.9688180.8203
Module start 'content' 0.00890.8056 769.7891497.2734
Module end 'content' 0.81440.1312 1,267.0625333.4766
Script end 0.9457  1,600.5391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4601210.0002
Check MTime0.00180.1955210.0001
Mysql Total
Database connection0.00090.093310.0009
Mysqli_queries0.876692.68541910.0046
Looping result0.00210.22481890.0000
Template Total0.913296.620.4566
Template load0.00280.295620.0014
Template processing0.910396.256920.4552
Template load and register function0.00020.022510.0002
states
state_id_array0.00090.091810.0009
state_identifier_array0.00080.085220.0004
Override
Cache load0.00240.2524300.0001
Sytem overhead
Fetch class attribute can translate value0.00140.143830.0005
Fetch class attribute name0.00090.095320.0005
XML
Image XML parsing0.00060.063930.0002
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00220.2316210.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs