RMA Startup script for Red Hat 9

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
ikevin
Posts: 2
Joined: Thu Sep 08, 2005 12:24 am

RMA Startup script for Red Hat 9

Post by ikevin »

how to add Startup sciprt for Redt Hat 9 that make it start automatic ?
thx a lot
KS-Soft
Posts: 12903
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I think you should add command that starts agent into /etc/rc.d/rc.local file

Regards
Alex
ikevin
Posts: 2
Joined: Thu Sep 08, 2005 12:24 am

Post by ikevin »

Would you pls give me more detail step ? thx a lot
KS-Soft
Posts: 12903
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Add rmapath/rma rmapath/rma.ini line into /etc/rc.d/rc.local file. Where rmapath is path to directory where agent is installed

Regards
Alex
r3boot
Posts: 7
Joined: Wed Jun 08, 2005 7:50 am
Contact:

Post by r3boot »

FYI, here's the init script that we're using on RHEL3/4 boxen; place in /etc/init.d and activate with chkconfig --add <script-name>. It's written in POSIX sh, so it should be usable on any platform that does sh and SYSV init (although you might have to fiddle with the ps arguments depending on your platform):

Code: Select all

#!/bin/sh
# chkconfig: 2345 20 80
# description: Hostmonitor RMA

RMA_PWD="/opt/hostmonitor"
RMA_BIN="${RMA_PWD}/rma"
RMA_INI="${RMA_PWD}/rma.ini"

case "${1}" in
        start)
                echo -n "Starting Hostmonitor RMA: "
                ${RMA_BIN} -d ${RMA_INI} &>/dev/null
                echo "done"
                ;;
        stop)
                echo -n "Stopping Hostmonitor RMA: "
                PID="$(ps ax | grep ${RMA_BIN} | grep -v grep | awk '{print $1}')"
                if [ x"${PID}" != x"" ]; then
                        kill ${PID} &>/dev/null
                        sleep 1
                        kill -9 ${PID} &>/dev/null
                fi
                echo "done"
                ;;
        restart)
                ${0} stop
                sleep 1
                ${0} start
                ;;
        *)
                echo "Usage: `basename ${0}` <start|stop|restart>"
                exit 1
                ;;
esac
exit 0
jivetolkein
Posts: 96
Joined: Thu Jul 19, 2007 4:35 am

Post by jivetolkein »

Sorry to dig up an old thread but I thought it might be useful to add:

Use the above init script by copying it into /etc/init.d

Make it runnable:

chmod +x /etc/init.d/rma
chown 744 /etc/init.d/rma

.. then add it to chkconfig as appears to be the RHEL way..

chkconfig --add rma
chkconfig --level 35 rma on

.. and check your work with

chkconfig --list rma

.. which should show rma running in the approprite run levels.

You can then use

service rma (start|stop|restart)

.. to control it as per most other services.
jivetolkein
Posts: 96
Joined: Thu Jul 19, 2007 4:35 am

Post by jivetolkein »

Should add I save the init script as

rma

.. just to be clear
Post Reply