1 year ago
#324624

sandeep nandula
Scheduling a pgagent job for every alternate friday
I am unbale to find a way to schedule pgagent job for every alternate fridays.Can anybody help me with that ? Below is the code shell script I include it in pgagent job
#!/bin/bash
#backup directory can be a file server share that the PgAgent
daemon account has access to
BACKUPDIR="/home/natasha/databasebackup"
PGHOST="localhost"
PGUSER="postgres"
PGBIN="/usr/bin"
PGDATABASE="backup"
thedate=`date --date="today" +%Y%m%d%H`
thefortnight=`date --date="today" +%Y%m%d`
#truncate history table
psql -h $PG_HOST -U $PGUSER -d $PGDATABASE -c "TRUNCATE TABLE
public.history;"
$PGBIN/pg_dump -h $PG_HOST -U $PGUSER -d $PGDATABASE -F c -b -v -f
$BACKUPDIR/$thedate.backup
postgresql
scheduling
pgadmin-4
pgagent
0 Answers
Your Answer