Skip to content

New annotation @JOB_RUN_ONLY_ONCE == @JOB_RUN_AFTER_SERVICE_START (run jobs only once after start jpgAgent) #11

@peterprvy

Description

@peterprvy

Hello! Thank for your agent.

I would need a feature that would find "specially annotated" jobs in pga_job and run them only once when jpgAgent is started:
`
sql.properties:

sql.jpgagent.get_job_run_only_once =\
UPDATE pgagent.pga_job \
SET jobagentid=?, joblastrun=now() \
WHERE jobenabled = false\                                             # false = so that it does not start periodically
AND jobagentid IS NULL \
AND jobnextrun <= now() \
AND (jobhostagent = '' OR jobhostagent = ?) \
AND job_desc like '%@JOB_???%'                                        # special annotation  @JOB_RUN_ONLY_ONCE=true;
RETURNING jobid, jobname, jobdesc;

I need after a power failure, or restart the server, run some tasks only once (they generate data that is generated periodically).

jpgAgent would perform these jobs only once during the first successful connection to the postgre database

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions