VMware Cloud Community
gdepratt
Contributor
Contributor

Server and agent automatic start in Linux

I have been looking around and haven't found the right info.
I am running HQ Server 4.1.0 on CentOS and I can't figure out how to get Hyperic to automatically start on boot. Surely there is some documentation on how to do this, can someone point me in the right direction? I have tried adding a link to init.d and chkconfig -add , but it says that hq-server does not support chkconfig.

My end goal is to have the Server and the Agent automatically start on boot like Windows does. Thanks in advance for your help.

Greg
Reply
0 Kudos
2 Replies
bjchip_hyperic
Enthusiast
Enthusiast

You need to put scripts in rc3.d and others to tell the system to do stuff as each run level is entered. . The init.d is the engineroom but the commands come from the rc files, which have some name sensitivities that you might want to read through before you get burnt. The execution order in a runlevel is determined by the number associated with the file. S starts, K is to kill, and don't let a lowercase fool you.


BJ
Reply
0 Kudos
Boris59
Enthusiast
Enthusiast

I just did this for my Ubuntu Linux systems, so here's the tutorial for the server (agent works the same). I assume the server was installed into the folder /home/hyperic/server-4.1.0 with the user hyperic.

* Place the following content into the file /etc/init.d/hq-server.
#! /bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Hyperic HQ Server"
NAME=hq-server
DAEMON=/home/hyperic/server-4.1.0/bin/$NAME.sh
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

case "$1" in
start)
sudo -u hyperic -H -s $DAEMON start
;;
stop)
sudo -u hyperic -H -s $DAEMON stop
;;
restart|force-reload)
sudo -u hyperic -H -s $DAEMON stop
sudo -u hyperic -H -s $DAEMON start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:


* Make the file executable
chmod +x /etc/init.d/hq-server

* Place links to this scripts for startup and shutdown as mentioned by BJ. The following lines cause the server to start on runlevels 2 thru 5 (where network is available) and stop on runlevels 0, 1 and 6.

cd /etc/rc0.d
ln -s ../init.d/hq-server K01hq-server
cd ../rc1.d
ln -s ../init.d/hq-server K01hq-server
cd ../rc2.d
ln -s ../init.d/hq-server S99hq-server
cd ../rc3.d
ln -s ../init.d/hq-server S99hq-server
cd ../rc4.d
ln -s ../init.d/hq-server S99hq-server
cd ../rc5.d
ln -s ../init.d/hq-server S99hq-server
cd ../rc6.d
ln -s ../init.d/hq-server K01hq-server


Works for me.

Cheers, Bjoern
Reply
0 Kudos