Обсуждение: pgAgent - adding parameters to runs

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

pgAgent - adding parameters to runs

От
Bastiaan Olij
Дата:
Hi all,

I'm just throwing this out there to see if any one has had ideas about
doing this or can suggest a workaround. It may be the final push I need
to download the source and try my hand at extending pgAgent myself :)

The situation we have is that we have multiple databases on our server
and that we have the need to run backups for these databases
individually. Right now we solve this by having a job for each database
configured in pgAgent so we can run the backup script for that specific
database.

Ideally I would like to have a single job configured in pgAgent but when
I tell the job to run, give it one or more parameters that can be
inserted into the script text of the step(s) of the job.
To make this work properly however storing a single parameter and
runtime won't suffice as it is possible that I may schedule runs for
several databases one after another each with a different setting for
the parameter(s).

The idea I had for that last issue is to add a queue table to pgAgent
where you can queue running a job outside of the normal "next schedule"
logic that currently exists.

An alternative I've been wondering about but have no idea whether it is
feasible is to have the pgAgent jobs stored in each individual database,
but it would require pgAgent to log onto each database to see if there
is a job to run in that database.

Any ideas would be welcomed:)

Cheers,

Bastiaan Olij



Re: pgAgent - adding parameters to runs

От
Dinesh Kumar
Дата:
Hi Bastiaan Olij,

On Tue, Dec 10, 2013 at 2:55 AM, Bastiaan Olij <bastiaan@basenlily.me> wrote:
Hi all,

I'm just throwing this out there to see if any one has had ideas about
doing this or can suggest a workaround. It may be the final push I need
to download the source and try my hand at extending pgAgent myself :)

The situation we have is that we have multiple databases on our server
and that we have the need to run backups for these databases
individually. Right now we solve this by having a job for each database
configured in pgAgent so we can run the backup script for that specific
database.

Ideally I would like to have a single job configured in pgAgent but when
I tell the job to run, give it one or more parameters that can be
inserted into the script text of the step(s) of the job.
To make this work properly however storing a single parameter and
runtime won't suffice as it is possible that I may schedule runs for
several databases one after another each with a different setting for
the parameter(s).

The idea I had for that last issue is to add a queue table to pgAgent
where you can queue running a job outside of the normal "next schedule"
logic that currently exists.

An alternative I've been wondering about but have no idea whether it is
feasible is to have the pgAgent jobs stored in each individual database,
but it would require pgAgent to log onto each database to see if there
is a job to run in that database.

Any ideas would be welcomed:)


Does it work for you. Make this script as a single job to the pgAgent.

Regards,
Dinesh
 
Cheers,

Bastiaan Olij


--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Re: pgAgent - adding parameters to runs

От
Bastiaan Olij
Дата:
Hi Dinesh,

On 10/12/13 5:26 PM, Dinesh Kumar wrote:

Does it work for you. Make this script as a single job to the pgAgent.
We already use that approach but it would still require us to configure a job for each database that calls the batch file with the database name as a parameter (which is how we are doing things today).

As we regularly add new databases and remove ones we no longer need that gives us a lot of overhead in maintaining the pgAgent jobs with a high risk of typos sneaking in when we do so.

None of these jobs are scheduled, we have a nightly backup script that backs up all databases with one script that detects which databases exist. These jobs are for incidental backups such as ones we run on an individual database before performing schema changes or certain processes where we need to be able to go back to backup if things go wrong.

Cheers,

Bas

Re: pgAgent - adding parameters to runs

От
Dinesh Kumar
Дата:
Hi Bastiaan,

On Wed, Dec 11, 2013 at 7:56 AM, Bastiaan Olij <bastiaan@basenlily.me> wrote:
Hi Dinesh,


On 10/12/13 5:26 PM, Dinesh Kumar wrote:

Does it work for you. Make this script as a single job to the pgAgent.
We already use that approach but it would still require us to configure a job for each database that calls the batch file with the database name as a parameter (which is how we are doing things today).

I don't believe, pgagent/pgAdmin do support of interactive jobs. Once we schedule it, it don't ask or wait to take inputs from user.
 
As we regularly add new databases and remove ones we no longer need that gives us a lot of overhead in maintaining the pgAgent jobs with a high risk of typos sneaking in when we do so.
 
OK.
 
None of these jobs are scheduled, we have a nightly backup script that backs up all databases with one script that detects which databases exist.

OK.

I don't know any other solution apart form this.

1. Create a native script, which takes the list of databases as input. {Like what i have shared earlier}.

2. Schedule this job on template database, and disable it by default.

3. When you want to take a backup(s).
          
       1. Go to the step's of the backup job.
       2. Modify the job with required database names as argument to the script, using it's properties dialogue.
       3. Click on "Run Now" at the job level.

Otherwise,
We need to schedule the backup jobs on all the databases, and do "Run Now" when you want to take the backup of a specific database.

Otherwise,
Need to tweak the pgagent catalogs.

Thanks,
Dinesh

Cheers,

Bas