On Tue, 2014-03-04 at 18:19 +0000, Jim Stewart wrote:
> It would be nice to know how to “restore” the database via an
> automatic script at the remote end (been using rdadmin manually).
> Perhaps I can use a mysql restore command of some sort?  I don’t know
> mysql at all, have had issue with it, am afraid of it, and finally
> consider it Rivendell’s worst attribute.

this is a script I use to dump a file for each of my 'out stations' from
the central server. it runs at :45 as a cron job

The remotes are "Wireless" "Thames" and "Whangamata"

Data for all services is kept in the central server. This is a belt and
braces update. Seperately each remote service pulls down their weather
and other local items as an mp3 file from the same server.

The updates complete by :52 and locally stations pull down news and
other items which they load from :55 to :59, updating their local
version of mysql 

Some programmes are loaded in the central server for all stations and
the audio gets networked as mp3 and loaded locally because updating wav
files is a bit data intensive. All music updates are distributed at 1am
which works because we typically add only a few tracks each week.

this is the server script

#! /bin/bash
# get tables related to individual services and put them in dropbox
mysql -u root Rivendell -e 'show tables like "%ireless%" ' -s
--skip-column-names | xargs mysqldump Rivendell -u root
>/home/rd/dropbox/wireless.sql
mysql -u root Rivendell -e 'show tables like "%hangamata%" ' -s
--skip-column-names | xargs mysqldump Rivendell -u root
>/home/rd/dropbox/whangamata.sql
mysql -u root Rivendell -e 'show tables like "%hames%" ' -s
--skip-column-names | xargs mysqldump Rivendell -u root
>/home/rd/dropbox/thames.sql
#get tables all services need to update and put them in dropbox
mysqldump -u root Rivendell --lock-tables=false AUDIO_PERMS CART
CLOCK_PERMS CLOCKS CUTS EVENT_PERMS EVENTS GROUPS SCHED_CODES
SERVICE_PERMS SERVICES LOGS>/home/rd/dropbox/hourly.sql
exit 0



at the remote station

we rsync the station.sql and hourly.sql into a local folder from the
central server 

mysql -u root Rivendell /home/rd/dropbox/hourly.sql
mysql -u root Rivendell /home/rd/dropbox/station.sql


I could have made it smarter and tidier, but this transports the
essential changes in small text files that move fast and are 100%
accurate.

mysql makes this kind of thing possible, and enables Rivendell to
function as it does. 

Well worth making friends with! I got a mysql for dummies book and while
I think I am just a novice I have learnt to do stuff with it. Very
powerful tool.

regards

Robert Jeffares


_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev

Reply via email to