Installation of pgagent in Linux
. pgagent is used as an alternative for crontab scheduler or windows scheduler.
Installation of pgagent:
Create a repository in Linux using the disk or online.
yum -y install gtk*
yum -y install automake*
yum -y install autoconf*
yum -y install gcc*
yum -y install libxml2*
yum -y install libxslt*
yum -y install python*
install wxGTK 2.8.x from http://www.wxwidgets.org/
************************************************
Unpack the wxGTK tarball to a convenient location, and build and install it as follows:
cd /path/to/wxGTK/source/
./configure –with-gtk –enable-gtk2 –enable-unicode
make
sudo make install
# Install wxWidgets contrib modules.
cd contrib/
make
sudo make install
************************************************
Download the pgagent source from (https://www.pgadmin.org/download/pgagent-source-code/) and follow the below procedure.
export LD_LIBRARY_PATH=/usr/local/lib:/home/postgres/SOFTWARE_9.6/lib:/usr/lib
export PATH=/home/postgres/SOFTWARE_9.6/bin:$PATH
untar the downloaded pgagent source and follow below steps.
[root@localhost Desktop]# cd pgAgent-3.4.0-Source/
[root@localhost pgAgent-3.4.0-Source]# cmake -D PG_CONFIG_PATH:FILEPATH=/home/postgres/SOFTWARE_9.6/bin/pg_config -D STATIC_BUILD:BOOL=OFF .
—
— ================================================================================
— Configuration summary:
—
— Project : pgagent
— Description : pgAgent is a job scheduling engine for PostgreSQL
— Version : 3.4.0
—
— PostgreSQL version string : PostgreSQL 9.6.6
— PostgreSQL version parts : 9.6.6
— PostgreSQL path : /home/postgres/SOFTWARE_9.6
— PostgreSQL config binary : /home/postgres/SOFTWARE_9.6/bin/pg_config
— PostgreSQL include path : /home/postgres/SOFTWARE_9.6/include
— PostgreSQL library path : /home/postgres/SOFTWARE_9.6/lib
— PostgreSQL share path : /home/postgres/SOFTWARE_9.6/share
—
— wxWidgets version : 2.8.12
— wxWidgets path : /usr/local
— wxWidgets config binary : /usr/local/bin/wx-config
— wxWidgets Static linking : OFF
— wxWidgets Debug? : NO
— ================================================================================
—
— Configuring done
— Generating done
— Build files have been written to: /root/Desktop/pgAgent-3.4.0-Source
[root@localhost pgAgent-3.4.0-Source]# make
Scanning dependencies of target pgagent
[ 12%] Building CXX object CMakeFiles/pgagent.dir/connection.cpp.o
[ 25%] Building CXX object CMakeFiles/pgagent.dir/job.cpp.o
[ 37%] Building CXX object CMakeFiles/pgagent.dir/misc.cpp.o
[ 50%] Building CXX object CMakeFiles/pgagent.dir/pgAgent.cpp.o
[ 62%] Building CXX object CMakeFiles/pgagent.dir/precomp.cpp.o
[ 75%] Building CXX object CMakeFiles/pgagent.dir/unix.cpp.o
[ 87%] Building CXX object CMakeFiles/pgagent.dir/win32.cpp.o
Linking CXX executable pgagent
[ 87%] Built target pgagent
Scanning dependencies of target run
[100%] Generating pgagent–3.4.sql, pgagent.control
[100%] Built target run
[root@localhost pgAgent-3.4.0-Source]# make install
[ 87%] Built target pgagent
[100%] Built target run
Install the project…
— Install configuration: “release”
— Installing: /usr/local/bin/pgagent
— Removed runtime path from “/usr/local/bin/pgagent”
— Installing: /usr/local/share/pgagent.sql
— Installing: /usr/local/share/pgagent_upgrade.sql
— Installing: /usr/local/./README
— Installing: /usr/local/./LICENSE
— Installing: /home/postgres/SOFTWARE_9.6/share/extension/pgagent–3.4.sql
— Installing: /home/postgres/SOFTWARE_9.6/share/extension/pgagent.control
— Installing: /home/postgres/SOFTWARE_9.6/share/extension/pgagent–unpackaged–3.4.sql
[root@localhost pgAgent-3.4.0-Source]#
chown -R postgres:postgres /home/postgres/SOFTWARE_9.6
Now create pgagent extension.
postgres=# create extension pgagent ;
CREATE EXTENSION
Starting the pgagent in background:
Create below script in “/etc/init.d” location.
***************************************************************************
[root@localhost postgres]# cat /etc/init.d/pgagent
#!/bin/bash
#
# /etc/rc.d/init.d/pgagent
#
# Manages the pgagent daemon
#
# chkconfig: 2345 80 05
# description: PgAgent PostgreSQL Job Service
# processname: pgagent
export LD_LIBRARY_PATH=/usr/local/lib:/home/postgres/SOFTWARE_9.6/lib:/usr/lib
export PATH=/home/postgres/SOFTWARE_9.6/bin:$PATH
RETVAL=0
prog=”PgAgent”
start() {
echo -n “Starting $prog: “
nohup /usr/local/bin/pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres & > /tmp/t.out
RETVAL=$?
echo
}
stop() {
echo -n “Stopping $prog: “
killall /usr/local/bin/pgagent
RETVAL=$?
echo
}
case “$1” in
start)
start
;;
stop)
stop
;;
reload|restart)
stop
start
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|reload|status}”
exit 1
esac
exit $RETVAL
**********************************************************************
# Execute below command to add pgagent in autostart script of server, whenever server reboots automatically the pgagent starts.
chkconfig –add pgagent
Execute below command to start the pgagent service
service pgagent start
This comment has been removed by the author.
LikeLike
This comment has been removed by the author.
LikeLike