Search Postgresql Archives

Error in function to pg_dump: Standard in must be a tty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Postgresql 7.3.4
RH 8.0

Hello all,

The client requirements are that from the website(a coldfusionmx app), they
could backup and restore the database from the list of backups available.
All i've given to work on is just that to allow user to select backup to
restore and also to allow user to perform a manual database backup.

Here's how the "manual backup" process goes. When user clicks on "Backup
Database Now", a row is inserted to a table (app_dbactionb) to trigger off
the pg_dump. Problem is an error msg appeared when i insert test data into
table:

"standard in must be a tty."

Below are the functions and trigger concerned:
###################################
CREATE TRIGGER autobackup
    AFTER INSERT ON app_dbactionb
    FOR EACH ROW
    EXECUTE PROCEDURE initbackup ();


CREATE FUNCTION initbackup () RETURNS "trigger" AS '
 begin
  perform Backup ();
  return NEW;
 end;
' LANGUAGE 'plpgsql';


CREATE FUNCTION backup () RETURNS integer
    AS '
  system("/home/postgres/testbackupdb");
  return 0;
'LANGUAGE plperlu;
###################################

Below is the testbackupdb (chmod 777, owner postgres):

#!/bin/bash
#File is named according to abbreviation of week name (Sun...Sat)
#e.g. nsvm_Mon_2004.db

backupdate=`date +%a_%Y`
/bin/su - postgres -c "/usr/local/pgsql/bin/pg_dump -f
/home/postgres/nsvm_$backupdate.db nsvm"
echo "Backup at `date` :
nsvm_$backupdate.db">>/home/postgres/nsvm_backup_log


I really appreciate any form of advice and feedback on this error. Please
let me know too, if there are more efficient ways to allow user to backup
from a webpage :) Thank you all for the time.


Best regards,
siew hui





---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux