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,
compressesthe 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
triedsourcing 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
runthe 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