Hi again, Is it possible that there is a permission problem etc that don't allow plperlu function that calls a pg_dump command? I am still stumped, trying to solve the problem of "Standard in must be a tty" whenever i triggered the plperlu function :( Any advice is greatly appreciated. Thank you in advance. best regards, siew hui ----- Original Message ----- From: "Siew Hui, Wong" <shwong@sebasasia.com> Sent: Friday, April 09, 2004 11:27 AM Subject: Error in function to pg_dump: Standard in must be a tty > 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 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html