pgagent
A PostgreSQL job scheduler
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pgagent | 4.2.3 | ADMIN | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5880 | pgagent | No | Yes | No | Yes | No | No | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 4.2.3 | 1817161514 | pgagent | - |
| RPM | PGDG | 4.2.3 | 1817161514 | pgagent_$v | - |
| DEB | PGDG | 4.2.3 | 1817161514 | pgagent | - |
Install
You can install pgagent directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
pgAgent is a job scheduling agent for PostgreSQL, capable of running multi-step batch/shell scripts and SQL tasks on complex schedules. It runs as a daemon and stores job definitions in the database.
Core Concepts
- Job: A named schedulable unit containing one or more steps and schedules
- Step: An individual action (SQL script or OS batch/shell command) within a job
- Schedule: Defines when a job runs, with cron-like flexibility
Job Management via SQL
pgAgent stores its configuration in the pgagent schema. Jobs can be managed through pgAdmin or directly via SQL.
Step Types
| Kind | Description |
|---|---|
s | SQL script executed against a database |
b | Batch/shell command executed on the OS |
Schedule Fields
| Field | Description |
|---|---|
jscstart / jscend | Valid date range for the schedule |
jscminutes | Boolean array[60]: which minutes to run |
jschours | Boolean array[24]: which hours to run |
jscweekdays | Boolean array[7]: which days of week |
jscmonthdays | Boolean array[32]: which days of month |
jscmonths | Boolean array[12]: which months |
Security
The pgAgent daemon connects to the database using a stored connection string. Only database superusers or users granted appropriate privileges on the pgagent schema tables should manage jobs.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)