From: | MT <m_tessier(at)sympatico(dot)ca> |
---|---|
To: | GENERAL <pgsql-general(at)postgresql(dot)org> |
Subject: | Running pg_dump under vcron |
Date: | 2003-06-22 16:36:48 |
Message-ID: | 20030622123648.71eb27f3.m_tessier@sympatico.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi there,
I'm having a bit of trouble running a particular script with vcron. The script does a pg_dump of a postresql database, compresses the sql file and copies it to a remote server. I can run the script manually, as in
./scriptname.sh
But if I set the script to be run by vcron, as in
crontab -u root -e
0 16 * * * /path/to/scriptname.sh
Nothing happens.
I have inserted code into the script that rings the hardware bell. When I run the script with vcron, the hardware bell beeps. There's still no pg_dump of my database, however. The pg_dump directive is written as follows:
#!/bin/sh
/usr/bin/pg_dump -a -f /home/httpd/htdocs/db_name.sql db_name
Someone told me that the problem has to do with vcron not reading any rc. files to initialize its environment. So I tried sourcing my environment initiation files in the script as follows:
. /etc/profile
. ${HOME}/.profile
This caused the script to stop functioning altogether.
I should note that pg_dump runs for the particular database I want to backup under my user name. If I try to manually run the script as root, I get
pg_dump: [archiver (db)] connection to database "db_name" failed: FATAL: user "root" does not exist
Since cron is run as root, I modified the pg_dump as follows:
/usr/bin/pg_dump -S user -a -f /home/httpd/htdocs/db_name.sql db_name
This didn't help either.
If anybody has any suggestions, please tell me.
Mark
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-06-22 17:46:59 | Re: A creepy story about dates. How to prevent it? |
Previous Message | Ron Johnson | 2003-06-22 15:21:59 | Re: A creepy story about dates. How to prevent it? |