Thread: Cronjob errors
I am trying to make a pg_dumpall via a cronjob. Using Redhat ES release 4 (Nahant Update 5) and postgresql-7.4.17-1.RHEL4.1.
The error I get is:
Date: Wed, 14 Nov 2007 04:00:01 +0200
From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <postgres@localhost> /usr/local/bin/dspace_postgres_backup >1
+/dev/null
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=postgres>
X-Cron-Env: <USER=postgres>
/bin/bash: 1: No such file or directory
My shell script in /usr/local/bin is:
#!/bin/bash
FNAME=dspace.`date +%F`.backup
#echo $FNAME
/usr/bin/pg_dumpall -c -o > /data/dspace_backups/$FNAME
gzip /data/dspace_backups/$FNAME
My crontab in /etc is:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
00 4 * * * postgres /usr/local/bin/dspace_postgres_backup >1 /dev/null
Any advise will be appreciated!
> 00 4 * * * postgres /usr/local/bin/dspace_postgres_backup >1 /dev/null Change the >1 to 1> THINK BEFORE YOU PRINT - Save paper if you don't really need to print this *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments e-mail.