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.