Hi,

Just thought I'd post up in case it is useful to others. This script will make a copy of the live database (fpl2) to the copy (fpl2copy) and then changes the background colour to make it easier to distinguish.

#!/bin/bash

echo
echo `date`
echo "Copying fpl2 to fpl2copy..."

# Make safety copy.
pg_dump --clean -h localhost -U phppgadmin fpl2 > /var/backups/fpl2_to_copy.pgd

# Simplest way is to drop the copy database and then recreate from the original.
psql -c "DROP DATABASE fpl2copy;" -U phppgadmin -h localhost template1
psql -c "CREATE DATABASE fpl2copy WITH TEMPLATE fpl2 OWNER lsadmin" -U phppgadmin -h localhost template1 psql -h localhost -U phppgadmin -c "UPDATE user_preference SET stylesheet = 'ledgersmb-yellow.css';" fpl2copy

echo
echo `date`
echo "Finished."

This needs the phppgadmin user to be able to login - maybe by setting the .pgpass file. The PG user account I use for setup.pl etc and to own all the LS databases is lsadmin.

Regards,

Kevin Bailey
------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
Ledger-smb-users mailing list
Ledger-smb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users

Reply via email to