Обсуждение: cron & backup

Поиск
Список
Период
Сортировка

cron & backup

От
v.demartino2@virgilio.it
Дата:
At office we have a Win2k LAN to which my freebsd postgresql server box
is connected via Samba. On this box I have a script, called 'crono', which
is dealt by /usr/bin/cron every working day's  night at 1 am.  As you can
see below this crono script vacuums all the DBs and dumps mydb to a samba
share.

##crono file
vacuumdb -a -U victor
pg_dump --create --format=c -O -Uvictor --file=/root/my_dump/mydb.sql.gz
mydb
##

Now if I execute the script by hand as root it all works smoothly but cron
fails frequently to start or complete the execution of the script even though
in the cron log I see that it starts it regularly as root at 1 am.

The fact is that I don't have any other clue on what is going wrong because
of the poor log.

What logs shoiuld I enable in the postgresql.conf configuration file to
trace what's going on with the vacuumdb and  pg_dump commands?

Ciao
Vittorio




Re: cron & backup

От
Lonni J Friedman
Дата:
On Tue, 18 Jan 2005 11:12:34 +0100, v.demartino2@virgilio.it
<v.demartino2@virgilio.it> wrote:
> At office we have a Win2k LAN to which my freebsd postgresql server box
> is connected via Samba. On this box I have a script, called 'crono', which
> is dealt by /usr/bin/cron every working day's  night at 1 am.  As you can
> see below this crono script vacuums all the DBs and dumps mydb to a samba
> share.
>
> ##crono file
> vacuumdb -a -U victor
> pg_dump --create --format=c -O -Uvictor --file=/root/my_dump/mydb.sql.gz
> mydb
> ##
>
> Now if I execute the script by hand as root it all works smoothly but cron
> fails frequently to start or complete the execution of the script even though
> in the cron log I see that it starts it regularly as root at 1 am.
>
> The fact is that I don't have any other clue on what is going wrong because
> of the poor log.
>
> What logs shoiuld I enable in the postgresql.conf configuration file to
> trace what's going on with the vacuumdb and  pg_dump commands?

Normally cronjob output is sent to the email address of its owner.  Is
root receiving any email output from this cronjob?  Also, you should
add the -z and -f switches to vacuumdb.

If I had to guess on your probem above, i'd say it could be a $PATH
issue, since you're not specifying the path for vacuumdb.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama@gmail.com
LlamaLand                       http://netllama.linux-sxs.org

Re: cron & backup

От
Allen
Дата:
I had a problem in the past with the vaccumdb command on 7.2.3
mysteriously never returning when run from cron on FreeBSD, but it ran
fine from cmdline. Had to be an environmental issue. Not having time to
track it down, I tried an alternative lazy method...

/usr/local/bin/vacuumdb -z -f dbname   <-- sometimes never returned

/usr/local/bin/psql -c "vacuum full analyze;" dbname <-- worked

Though I would really prefer to know *what* the problem was so it
wouldn't happen elsewhere. For me the path was specified, but since the
job never terminated, I received no email. If you find the reason, post it!

Good luck!
Allen

v.demartino2@virgilio.it wrote:
> At office we have a Win2k LAN to which my freebsd postgresql server box
> is connected via Samba. On this box I have a script, called 'crono', which
> is dealt by /usr/bin/cron every working day's  night at 1 am.  As you can
> see below this crono script vacuums all the DBs and dumps mydb to a samba
> share.
>
> ##crono file
> vacuumdb -a -U victor
> pg_dump --create --format=c -O -Uvictor --file=/root/my_dump/mydb.sql.gz
> mydb
> ##
>
> Now if I execute the script by hand as root it all works smoothly but cron
> fails frequently to start or complete the execution of the script even though
> in the cron log I see that it starts it regularly as root at 1 am.
>
> The fact is that I don't have any other clue on what is going wrong because
> of the poor log.
>
> What logs shoiuld I enable in the postgresql.conf configuration file to
> trace what's going on with the vacuumdb and  pg_dump commands?
>
> Ciao
> Vittorio
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

Re: cron & backup

От
Martijn van Oosterhout
Дата:
On Tue, Jan 18, 2005 at 06:30:32PM -0500, Allen wrote:
> I had a problem in the past with the vaccumdb command on 7.2.3
> mysteriously never returning when run from cron on FreeBSD, but it ran
> fine from cmdline. Had to be an environmental issue. Not having time to
> track it down, I tried an alternative lazy method...
>
> /usr/local/bin/vacuumdb -z -f dbname   <-- sometimes never returned

If it never returned it would still be running right. So it should show
up when you run "ps". You would be able to strace to see what the
problem was. Note, if a script has no output you don't get an email
either.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

Re: cron & backup

От
Vittorio De Martino
Дата:
Alle 14:38, martedì 18 gennaio 2005, Lonni J Friedman ha scritto:
> On Tue, 18 Jan 2005 11:12:34 +0100, v.demartino2@virgilio.it
>
> <v.demartino2@virgilio.it> wrote:
> > At office we have a Win2k LAN to which my freebsd postgresql server box
> > is connected via Samba. On this box I have a script, called 'crono',
> > which is dealt by /usr/bin/cron every working day's  night at 1 am.  As
> > you can see below this crono script vacuums all the DBs and dumps mydb to
> > a samba share.
> >
> > ##crono file
> > vacuumdb -a -U victor
> > pg_dump --create --format=c -O -Uvictor --file=/root/my_dump/mydb.sql.gz
> > mydb
> > ##
> >
> > Now if I execute the script by hand as root it all works smoothly but
> > cron fails frequently to start or complete the execution of the script
> > even though in the cron log I see that it starts it regularly as root at
> > 1 am.
> >
> > The fact is that I don't have any other clue on what is going wrong
> > because of the poor log.
> >
> > What logs shoiuld I enable in the postgresql.conf configuration file to
> > trace what's going on with the vacuumdb and  pg_dump commands?
>
> Normally cronjob output is sent to the email address of its owner.  Is
> root receiving any email output from this cronjob?  Also, you should
> add the -z and -f switches to vacuumdb.
>
> If I had to guess on your probem above, i'd say it could be a $PATH
> issue, since you're not specifying the path for vacuumdb.

You were right! The only problem was the absence of the directories of the
command vacuumdb and pg_dump. I added the Iusr/local/bin/ prefic to both and
now it all works smoothly.

Thanks
Vittorio

Re: cron & backup

От
Vittorio De Martino
Дата:
Alle 14:38, martedì 18 gennaio 2005, Lonni J Friedman ha scritto:
> On Tue, 18 Jan 2005 11:12:34 +0100, v.demartino2@virgilio.it
>
> <v.demartino2@virgilio.it> wrote:
> > At office we have a Win2k LAN to which my freebsd postgresql server box
> > is connected via Samba. On this box I have a script, called 'crono',
> > which is dealt by /usr/bin/cron every working day's  night at 1 am.  As
> > you can see below this crono script vacuums all the DBs and dumps mydb to
> > a samba share.
> >
> > ##crono file
> > vacuumdb -a -U victor
> > pg_dump --create --format=c -O -Uvictor --file=/root/my_dump/mydb.sql.gz
> > mydb
> > ##
> >
> > Now if I execute the script by hand as root it all works smoothly but
> > cron fails frequently to start or complete the execution of the script
> > even though in the cron log I see that it starts it regularly as root at
> > 1 am.
> >
> > The fact is that I don't have any other clue on what is going wrong
> > because of the poor log.
> >
> > What logs shoiuld I enable in the postgresql.conf configuration file to
> > trace what's going on with the vacuumdb and  pg_dump commands?
>
> Normally cronjob output is sent to the email address of its owner.  Is
> root receiving any email output from this cronjob?  Also, you should
> add the -z and -f switches to vacuumdb.
>
> If I had to guess on your probem above, i'd say it could be a $PATH
> issue, since you're not specifying the path for vacuumdb.

Lonni, you were right! The only problem was the absence of the directories of
the
command vacuumdb and pg_dump. I added the Iusr/local/bin/ prefic to both and
now it all works smoothly.

Thanks
Vittorio