gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Problems using gm-backup_database on debian, newest g


From: Slappinjohn
Subject: Re: [Gnumed-devel] Problems using gm-backup_database on debian, newest gnumed server/client
Date: Fri, 13 May 2011 22:30:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110402 Iceowl/1.0b2 Icedove/3.1.9

Hi Karsten,

mpfh, should have read the manpage of su carefully ;-), but the problem
with the ' and " is a real one, because in ' the variable names will not
be expanded, so the port number ist not passed to psql, see error message

etc/cron.daily/gnumed-server:

/usr/lib/postgresql/9.0/bin/psql: Diese Option benötigt ein Argument --
»p«
Versuchen Sie »psql --help« für weitere Informationen.

The configuration in /etc/gnumed/gnumed-backup.conf is set to backup

the GNUmed database gnumed_v15. This

database does not exist, however. Aborting.

I corrected the script and pgpass file

as you suggested and tata...! it's working. thx.

The line in gm-backup_database now is:

if ! su -c "psql -t -l -p ${GM_PORT}" -l postgres | grep -q
"^[[:space:]]*${GM_DATABASE}" ; then


Marc


Am 13.05.2011 11:42, schrieb Karsten Hilbert:
> Hi Marc,
> 
> thanks for you research and patch !
> 
>> I got mails on my new-setup-debian-testing-gnumed-server because of
>> uncompleted automatical backups of the database.
>>
>> it shows an error processing sanity-check in the gm-backup_database script.
> 
> What did those messages say, exactly ?
> 
> Perhaps there is some underlying bug that we need to correct.
> 
>> I corrected this (mainly some " instead of ' because of
>> variable-expansion in the sanity-check function) --> appendix
> 
> This is what you suggest to do:
> 
>> # sanity check
>> if ! su -c "psql -U postgres -t -l -p ${GM_PORT} -l postgres" | grep -q 
>> "^[[:space:]]*${GM_DATABASE}" ; then
> 
> However, there's a problem with that. By moving the " after
> the //-l postgres// you are effectively taking away the "-l
> postgres" from the "su" command (where it meant:
> 
>       su to the -l(ogin) "postgres"
> 
> ) and adding it to the "psql" command (where it now means:
> 
>       duplicate the -l(ist) option and try connecting to the
>       "postgres" database
> 
> ). The su now means:
> 
>       "su to the user root"
> 
> Root then tries to connect to the database "postgres" as
> (-U)ser postgres which may or may not succeed depending on
> the system setup.
> 
>> another problem was to automaticly pass the password for gm-dbo
>>
>> I put it in /root/.pgpass (localhost:5432:gnumed*:gm-dbo:secret)
> 
> I'm sure you chmod'ed that to 0600.
> 
> Can you (as root)
> 
>       psql -U gm-dbo -d gnumed_vXX
> 
> ?
> 
>> and /var/lib/postgres/.pgpass --> no working solution
> 
> In fact, that line above will not work. It must be:
> 
>       localhost:5432:*:gm-dbo:secret
> 
> This is what the PG docs say:
> 
>       Each of the first four fields can be a literal value, or
>       *, which matches anything
> 
> So it's not a regex but rather either or.
> 
> Karsten



reply via email to

[Prev in Thread] Current Thread [Next in Thread]