Thread: init script for redhat

init script for redhat

From
"Jeremy Palmer"
Date:
Hi,

I've hacked together a quick init script for pgagent. It might be useful for
others use.

It is hard coded to connect to the "pgadmin" database as the "postgres"
user. If others find this useful and have any suggested improvements, then
maybe we should fix it up and make it part of the Redhat/Fedora dist?

Cheers
Jeremy

Attachment

Re: init script for redhat

From
"Jeremy Palmer"
Date:
Ops sorry. It's a system script to run the pgagent program (which runs
scheduled pgadmin3 jobs) as a daemon. Place it in the /etc/init.d directory,
and install it i.e. "chkconfig --levels 345 pgagent on". Then the pgagent
should startup for the given boot levels.

Cheers
Jeremy

> -----Original Message-----
> From: Tomi NA [mailto:hefest@gmail.com]
> Sent: Thursday, 1 June 2006 10:43 p.m.
> To: Jeremy Palmer
> Subject: Re: [pgadmin-support] init script for redhat
> 
> On 6/1/06, Jeremy Palmer <palmerj@xtra.co.nz> wrote:
> > Hi,
> >
> > I've hacked together a quick init script for pgagent. It might be useful
> for
> > others use.
> >
> > It is hard coded to connect to the "pgadmin" database as the "postgres"
> > user. If others find this useful and have any suggested improvements,
> then
> > maybe we should fix it up and make it part of the Redhat/Fedora dist?
> 
> What exactly does the script do?
> 
> t.n.a.




Re: init script for redhat

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Jeremy Palmer
> Sent: 01 June 2006 11:39
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] init script for redhat
>
> Hi,
>
> I've hacked together a quick init script for pgagent. It
> might be useful for
> others use.
>
> It is hard coded to connect to the "pgadmin" database as the
> "postgres"

That should probably be the postgres database as well.

> user. If others find this useful and have any suggested
> improvements, then
> maybe we should fix it up and make it part of the Redhat/Fedora dist?

Don't see why not. When you're happy with it, please forward it to the
list for addition to the source tree.

Regards, Dave


Re: init script for redhat

From
"Jeremy Palmer"
Date:
Ok I have attached a modified init script, which now uses the postgres
database. The logging is also redirected to pgagent.log in the pgsql home
directory. Could this please be added to the source tree?

Note: because pgagent does not flush the buffer for every log message, the
log file does not see anything until the buffer is written. Maybe pgagent
could be changed to log to a file which is flushed periodically, instead of
stdout?

Cheers Jeremy

> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> Sent: Friday, 2 June 2006 2:24 a.m.
> To: Jeremy Palmer; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] init script for redhat
>
>
>
> > -----Original Message-----
> > From: pgadmin-support-owner@postgresql.org
> > [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> > Jeremy Palmer
> > Sent: 01 June 2006 11:39
> > To: pgadmin-support@postgresql.org
> > Subject: [pgadmin-support] init script for redhat
> >
> > Hi,
> >
> > I've hacked together a quick init script for pgagent. It
> > might be useful for
> > others use.
> >
> > It is hard coded to connect to the "pgadmin" database as the
> > "postgres"
>
> That should probably be the postgres database as well.
>
> > user. If others find this useful and have any suggested
> > improvements, then
> > maybe we should fix it up and make it part of the Redhat/Fedora dist?
>
> Don't see why not. When you're happy with it, please forward it to the
> list for addition to the source tree.
>
> Regards, Dave

Attachment

Re: init script for redhat

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Jeremy Palmer
> Sent: 04 June 2006 13:18
> To: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] init script for redhat
>
> Ok I have attached a modified init script, which now uses the postgres
> database. The logging is also redirected to pgagent.log in
> the pgsql home
> directory. Could this please be added to the source tree?

Sure - thanks.

Devrim; I was thinking of adding this to pkg/redhat, and leaving
installation up to the RPM (ie. Not installed by 'make install' because
it won't know what is or isn't an appropriate platform) - does that seem
reasonable to you?

> Note: because pgagent does not flush the buffer for every log
> message, the
> log file does not see anything until the buffer is written.
> Maybe pgagent
> could be changed to log to a file which is flushed
> periodically, instead of
> stdout?

A command line option to specify a logfile to use instead of stdout
would work, as might simply fflush()'ing stdout.

Care to work up a patch? :-)

Regards, Dave.


Re: init script for redhat

From
Devrim GUNDUZ
Date:
Hi Dave,

On Mon, 2006-06-12 at 14:34 +0100, Dave Page wrote:

> Devrim; I was thinking of adding this to pkg/redhat, and leaving
> installation up to the RPM (ie. Not installed by 'make install'
> because it won't know what is or isn't an appropriate platform) - does
> that seem reasonable to you? 

Go for it. I'll include this later in the RPMs.

Regards,
-- 
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/




Re: init script for redhat

From
"Jeremy Palmer"
Date:
Hi Dave,

Attached is a patch that allows pgagent to immediately log messages to file.
I have tentatively changed the cmd line switch for logging verbosity to "-s"
so "-l" can be used for the log file specification. I felt that this was
more intuitive.

If the patch is accepted, then a small change to the init script will need
to be made to accommodate the file logging...

Cheers
Jeremy

> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> Sent: Tuesday, 13 June 2006 1:35 a.m.
> To: Jeremy Palmer; pgadmin-support@postgresql.org
> Cc: Devrim GUNDUZ
> Subject: RE: [pgadmin-support] init script for redhat
>
>
>
> > -----Original Message-----
> > From: pgadmin-support-owner@postgresql.org
> > [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> > Jeremy Palmer
> > Sent: 04 June 2006 13:18
> > To: pgadmin-support@postgresql.org
> > Subject: Re: [pgadmin-support] init script for redhat
> >
> > Ok I have attached a modified init script, which now uses the postgres
> > database. The logging is also redirected to pgagent.log in
> > the pgsql home
> > directory. Could this please be added to the source tree?
>
> Sure - thanks.
>
> Devrim; I was thinking of adding this to pkg/redhat, and leaving
> installation up to the RPM (ie. Not installed by 'make install' because
> it won't know what is or isn't an appropriate platform) - does that seem
> reasonable to you?
>
> > Note: because pgagent does not flush the buffer for every log
> > message, the
> > log file does not see anything until the buffer is written.
> > Maybe pgagent
> > could be changed to log to a file which is flushed
> > periodically, instead of
> > stdout?
>
> A command line option to specify a logfile to use instead of stdout
> would work, as might simply fflush()'ing stdout.
>
> Care to work up a patch? :-)
>
> Regards, Dave.

Attachment

Re: init script for redhat

From
"Dave Page"
Date:

> -----Original Message-----
> From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> Sent: 15 June 2006 12:59
> To: Dave Page; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] init script for redhat
>
> Hi Dave,
>
> Attached is a patch that allows pgagent to immediately log
> messages to file.
> I have tentatively changed the cmd line switch for logging
> verbosity to "-s"
> so "-l" can be used for the log file specification. I felt
> that this was
> more intuitive.
>
> If the patch is accepted, then a small change to the init
> script will need
> to be made to accommodate the file logging...

Hi Jeremy,

Looks good - just a couple of points...

- Strings that are candidates for translation (when added to pgAgent)
should be wrapped in the _() macro, not wxT(); for example, your 'cannot
open the logfile' string.

- Changing the command line options is unnacceptable except in extreme
cases because it can easily confuse people when upgrading, expecially if
they miss the change. Please use -l for the loglevel as per current
releases and choose another letter for the logfile.

Thanks, Dave.


Re: init script for redhat

From
"Jeremy Palmer"
Date:
Ok, thanks for the tips. I have attached an updated patch.

Cheers
Jeremy

> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> Sent: Friday, 16 June 2006 12:09 a.m.
> To: Jeremy Palmer; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] init script for redhat
>
>
>
> > -----Original Message-----
> > From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> > Sent: 15 June 2006 12:59
> > To: Dave Page; pgadmin-support@postgresql.org
> > Subject: RE: [pgadmin-support] init script for redhat
> >
> > Hi Dave,
> >
> > Attached is a patch that allows pgagent to immediately log
> > messages to file.
> > I have tentatively changed the cmd line switch for logging
> > verbosity to "-s"
> > so "-l" can be used for the log file specification. I felt
> > that this was
> > more intuitive.
> >
> > If the patch is accepted, then a small change to the init
> > script will need
> > to be made to accommodate the file logging...
>
> Hi Jeremy,
>
> Looks good - just a couple of points...
>
> - Strings that are candidates for translation (when added to pgAgent)
> should be wrapped in the _() macro, not wxT(); for example, your 'cannot
> open the logfile' string.
>
> - Changing the command line options is unnacceptable except in extreme
> cases because it can easily confuse people when upgrading, expecially if
> they miss the change. Please use -l for the loglevel as per current
> releases and choose another letter for the logfile.
>
> Thanks, Dave.

Attachment

Re: init script for redhat

From
"Dave Page"
Date:
Thanks, patch applied!

Regards, Dave.

> -----Original Message-----
> From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> Sent: 15 June 2006 13:20
> To: Dave Page; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] init script for redhat
>
> Ok, thanks for the tips. I have attached an updated patch.
>
> Cheers
> Jeremy
>
> > -----Original Message-----
> > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > Sent: Friday, 16 June 2006 12:09 a.m.
> > To: Jeremy Palmer; pgadmin-support@postgresql.org
> > Subject: RE: [pgadmin-support] init script for redhat
> >
> >
> >
> > > -----Original Message-----
> > > From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> > > Sent: 15 June 2006 12:59
> > > To: Dave Page; pgadmin-support@postgresql.org
> > > Subject: RE: [pgadmin-support] init script for redhat
> > >
> > > Hi Dave,
> > >
> > > Attached is a patch that allows pgagent to immediately log
> > > messages to file.
> > > I have tentatively changed the cmd line switch for logging
> > > verbosity to "-s"
> > > so "-l" can be used for the log file specification. I felt
> > > that this was
> > > more intuitive.
> > >
> > > If the patch is accepted, then a small change to the init
> > > script will need
> > > to be made to accommodate the file logging...
> >
> > Hi Jeremy,
> >
> > Looks good - just a couple of points...
> >
> > - Strings that are candidates for translation (when added
> to pgAgent)
> > should be wrapped in the _() macro, not wxT(); for example,
> your 'cannot
> > open the logfile' string.
> >
> > - Changing the command line options is unnacceptable except
> in extreme
> > cases because it can easily confuse people when upgrading,
> expecially if
> > they miss the change. Please use -l for the loglevel as per current
> > releases and choose another letter for the logfile.
> >
> > Thanks, Dave.
>


Re: init script for redhat

From
"Jeremy Palmer"
Date:
I have attached a small patch to the Redhat pgagent init script to use the
new log to file options.

Cheers
Jeremy

> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> Sent: Friday, 16 June 2006 12:54 a.m.
> To: Jeremy Palmer; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] init script for redhat
>
> Thanks, patch applied!
>
> Regards, Dave.
>
> > -----Original Message-----
> > From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> > Sent: 15 June 2006 13:20
> > To: Dave Page; pgadmin-support@postgresql.org
> > Subject: RE: [pgadmin-support] init script for redhat
> >
> > Ok, thanks for the tips. I have attached an updated patch.
> >
> > Cheers
> > Jeremy
> >
> > > -----Original Message-----
> > > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > Sent: Friday, 16 June 2006 12:09 a.m.
> > > To: Jeremy Palmer; pgadmin-support@postgresql.org
> > > Subject: RE: [pgadmin-support] init script for redhat
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> > > > Sent: 15 June 2006 12:59
> > > > To: Dave Page; pgadmin-support@postgresql.org
> > > > Subject: RE: [pgadmin-support] init script for redhat
> > > >
> > > > Hi Dave,
> > > >
> > > > Attached is a patch that allows pgagent to immediately log
> > > > messages to file.
> > > > I have tentatively changed the cmd line switch for logging
> > > > verbosity to "-s"
> > > > so "-l" can be used for the log file specification. I felt
> > > > that this was
> > > > more intuitive.
> > > >
> > > > If the patch is accepted, then a small change to the init
> > > > script will need
> > > > to be made to accommodate the file logging...
> > >
> > > Hi Jeremy,
> > >
> > > Looks good - just a couple of points...
> > >
> > > - Strings that are candidates for translation (when added
> > to pgAgent)
> > > should be wrapped in the _() macro, not wxT(); for example,
> > your 'cannot
> > > open the logfile' string.
> > >
> > > - Changing the command line options is unnacceptable except
> > in extreme
> > > cases because it can easily confuse people when upgrading,
> > expecially if
> > > they miss the change. Please use -l for the loglevel as per current
> > > releases and choose another letter for the logfile.
> > >
> > > Thanks, Dave.
> >

Attachment

Re: init script for redhat

From
"Dave Page"
Date:
Thanks, patch applied.

Regards, Dave.

> -----Original Message-----
> From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> Sent: 16 June 2006 10:32
> To: Dave Page; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] init script for redhat
>
> I have attached a small patch to the Redhat pgagent init
> script to use the
> new log to file options.
>
> Cheers
> Jeremy
>
> > -----Original Message-----
> > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > Sent: Friday, 16 June 2006 12:54 a.m.
> > To: Jeremy Palmer; pgadmin-support@postgresql.org
> > Subject: RE: [pgadmin-support] init script for redhat
> >
> > Thanks, patch applied!
> >
> > Regards, Dave.
> >
> > > -----Original Message-----
> > > From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> > > Sent: 15 June 2006 13:20
> > > To: Dave Page; pgadmin-support@postgresql.org
> > > Subject: RE: [pgadmin-support] init script for redhat
> > >
> > > Ok, thanks for the tips. I have attached an updated patch.
> > >
> > > Cheers
> > > Jeremy
> > >
> > > > -----Original Message-----
> > > > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > > Sent: Friday, 16 June 2006 12:09 a.m.
> > > > To: Jeremy Palmer; pgadmin-support@postgresql.org
> > > > Subject: RE: [pgadmin-support] init script for redhat
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jeremy Palmer [mailto:palmerj@xtra.co.nz]
> > > > > Sent: 15 June 2006 12:59
> > > > > To: Dave Page; pgadmin-support@postgresql.org
> > > > > Subject: RE: [pgadmin-support] init script for redhat
> > > > >
> > > > > Hi Dave,
> > > > >
> > > > > Attached is a patch that allows pgagent to immediately log
> > > > > messages to file.
> > > > > I have tentatively changed the cmd line switch for logging
> > > > > verbosity to "-s"
> > > > > so "-l" can be used for the log file specification. I felt
> > > > > that this was
> > > > > more intuitive.
> > > > >
> > > > > If the patch is accepted, then a small change to the init
> > > > > script will need
> > > > > to be made to accommodate the file logging...
> > > >
> > > > Hi Jeremy,
> > > >
> > > > Looks good - just a couple of points...
> > > >
> > > > - Strings that are candidates for translation (when added
> > > to pgAgent)
> > > > should be wrapped in the _() macro, not wxT(); for example,
> > > your 'cannot
> > > > open the logfile' string.
> > > >
> > > > - Changing the command line options is unnacceptable except
> > > in extreme
> > > > cases because it can easily confuse people when upgrading,
> > > expecially if
> > > > they miss the change. Please use -l for the loglevel as
> per current
> > > > releases and choose another letter for the logfile.
> > > >
> > > > Thanks, Dave.
> > >
>