Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How to write init script for PGAgent

We  wrote an init script for PGAgent. It may need some tweaking but it gets the job done in our production environment.
#!/bin/bash
#
# /etc/init.d/pgagent
#

test -f /lib/lsb/init-functions || exit 1
. /lib/lsb/init-functions

PIDFILE=/var/run/pgagent.pid
prog=PGAgent
PGAGENTDIR=/usr/bin
PGAGENTOPTIONS="hostaddr=127.0.0.1 dbname=postgres user=postgres"

start() {
    log_begin_msg "Starting PGAgent"
    start-stop-daemon -b --start --quiet --exec "$PGAGENTDIR/pgagent" --name pgagent --startas "$PGAGENTDIR/pgagent" -- $PGAGENTOPTIONS || log_end_msg 1
    log_end_msg 0
}

stop() {
    log_begin_msg "Stopping PGAgent"
    start-stop-daemon --stop --quiet -n pgagent || log_end_msg 1
    log_end_msg 0
}

#
# See how we were called.
#
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  reload|restart)
    stop
    start
    RETVAL=$?
    ;;
  status)
    status /usr/bin/pgagent
    RETVAL=$?
    ;;
  *)
    log_success_msg "Usage: $0 {start|stop|restart|reload|status}"
    exit 1
esac

exit 0

Comments

Popular posts from this blog

ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

PostgreSQL Database startup / shutdown /restart

PostgreSQL Pgbadger Installation On Linux

PostgreSQL pgBadger