This script is only suitable for CentOS 5.4

You can run OpManager as a Unix Service.


Follow the steps mentioned below to install OpManager as a service on a linux box.

1. Copy the content given in blue below to a text file and save it to /etc/init.d directory as opmanager.

#!/bin/bash
#
# Startup script for the pmagent
#

# chkconfig: 345 99 02
# description: Run the OpManager 5 program

INITLOG_ARGS=""

prog="opmanager"
progname="AdventNet ManageEngine OpManager"
RETVAL=0
# Edit the following to indicate the 'bin' directory for your installation
MDIR=/usr/local/OpManager/bin
PRG=$MDIR/opmanager


if [ ! -d "$MDIR" ]
then
echo "Invalid directory $MDIR"
exit 1
fi

start()
{
mv -f /var/log/opmanager.log /var/log/opmanager1.log
echo "Starting $progname"
cd $MDIR
nohup sh StartOpManagerServer.sh >/var/log/opmanager.log 2>&1 &
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/OpManager
}

stop()
{
echo "Stopping $progname"
cd $MDIR
sh ShutDownOpManager.sh admin admin >>/var/log/opmanager.log 2>&1
}

case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Usage: $prog {start|stop}"
exit 1
;;
esac

exit $RETVAL



mv /etc/init.d/opmanager.txt /etc/init.d/opmanager

2. Edit the MDIR variable in this file which should point to the bin folder of OpManager Installation directory. Typically, the default installation folder on a Linux box will be /root/ManageEngine/OpManager/bin. Hence the value for MDIR will be

MDIR=/opt/ManageEngine/OpManager/bin

3. Provide executable permissions for this script using

chmod 755 /etc/init.d/opmanager

4. Use chkconfig command to add opmanager as a service

chkconfig --add opmanager

You can start OpManager in the nohup mode so you don't have to worry about the service being terminated when the console is closed. The service will continue to run in the background. Make these changes in the start and stop script files of OpManager:

in start
nohup /opt/ManageEngine/OpManager/bin/StartOpManagerServer.sh

in stop
nohup /opt/ManageEngine/OpManager/bin/ShutDownOpManager.sh