Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
On Nov 22, 2007 2:19 PM, Sorin N. Ciolofan <[EMAIL PROTECTED]> wrote: > Hello all! > > I've a small bash script backup.sh for creating dumps on my Postgre db: > > #!/bin/bash > time=`date '+%d'-'%m'-'%y'` > cd /home/swkm/services/test > pg_dump mydb > mydb_dump_$time.out > > I've edited crontab and added a line: > > 00 4 * * * swkm /home/swkm/services/test/backup.sh > > to execute the backup.sh as user swkm daily at 4 am. > > The user swkm is the user I use to create backups manually. The script > itself is executed fine if run manually but run on cron scheduler I got an > mydb_dump_$time.out file empty (of 0 kb) > > Do you have any idea about what's wrong? > > Thanks > Sorin > Hi Sorin, why don't you add a "MAILTO=" at the start of your crontab file, so that you can receive a report of the problem? Regards Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
Hi Marco! Thank you for the advice. I got: /home/swkm/services/test/backup.sh: line 4: pg_dump: command not found updating: mydb_dump_22-11-07.out (stored 0%) which seems strange -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Bizzarri Sent: Thursday, November 22, 2007 3:28 PM To: Sorin N. Ciolofan Cc: [EMAIL PROTECTED]; pgsql-general@postgresql.org Subject: Re: [ADMIN] backup of postgres scheduled with cron On Nov 22, 2007 2:19 PM, Sorin N. Ciolofan <[EMAIL PROTECTED]> wrote: > Hello all! > > I've a small bash script backup.sh for creating dumps on my Postgre db: > > #!/bin/bash > time=`date '+%d'-'%m'-'%y'` > cd /home/swkm/services/test > pg_dump mydb > mydb_dump_$time.out > > I've edited crontab and added a line: > > 00 4 * * * swkm /home/swkm/services/test/backup.sh > > to execute the backup.sh as user swkm daily at 4 am. > > The user swkm is the user I use to create backups manually. The script > itself is executed fine if run manually but run on cron scheduler I got an > mydb_dump_$time.out file empty (of 0 kb) > > Do you have any idea about what's wrong? > > Thanks > Sorin > Hi Sorin, why don't you add a "MAILTO=" at the start of your crontab file, so that you can receive a report of the problem? Regards Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
On Nov 22, 2007 2:46 PM, Sorin N. Ciolofan <[EMAIL PROTECTED]> wrote: > Hi Marco! > > Thank you for the advice. > > I got: > > /home/swkm/services/test/backup.sh: line 4: pg_dump: command not found > updating: mydb_dump_22-11-07.out (stored 0%) > > which seems strange > > Try putting the full path of the pg_dump command in the script. Regards Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
On Thu, Nov 22, 2007 at 02:28:08PM +0100, Marco Bizzarri wrote: > > why don't you add a "MAILTO=" at the start of your > crontab file, so that you can receive a report of the problem? Note: check that your cron accepts such an addition. Many systems now use Vixie's cron, which does accept that, but some don't. It's a nice feature, and good for this purpose. A -- Andrew Sullivan Old sigs will return after re-constitution of blue smoke ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
On Nov 22, 2007 2:53 PM, Andrew Sullivan <[EMAIL PROTECTED]> wrote: > On Thu, Nov 22, 2007 at 02:28:08PM +0100, Marco Bizzarri wrote: > > > > why don't you add a "MAILTO=" at the start of your > > crontab file, so that you can receive a report of the problem? > > Note: check that your cron accepts such an addition. Many systems now use > Vixie's cron, which does accept that, but some don't. It's a nice feature, > and good for this purpose. Andrew, can you confirm the previous statement? I'm checking on a Debian Linux, at it seems to be a Vixie Cron, and that feature is described in the man page... > > A > > -- > Andrew Sullivan > Old sigs will return after re-constitution of blue smoke Regards Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
On Thu, Nov 22, 2007 at 02:59:33PM +0100, Marco Bizzarri wrote: > Andrew, can you confirm the previous statement? I'm checking on a Debian > Linux, > at it seems to be a Vixie Cron, and that feature is described in the man > page... If the feature's in your man page, then it works on your system :) I just wanted to warn you that this isn't an original feature of cron, so you have to check your system always to be sure you have it. A -- Andrew Sullivan Old sigs will return after re-constitution of blue smoke ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] [ADMIN] backup of postgres scheduled with cron
On Thu, Nov 22, 2007 at 09:14:13AM -0500, Martin Gainty wrote: > > Good Morning AndrewI noticed the Vixie cron responds to SIGHUP signalsDo > you have any suggestions or tutorials on how Postgres would feed these > event signals to Vixie cron? Why would Postgres have to tell crond to restart? A -- Andrew Sullivan Old sigs will return after re-constitution of blue smoke ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster