Starting and Stopping the Agent daemon automatically
The Linux Monitoring Agent can be registered as a service that will start when the server enters runlevel 3 when the package is installed. This can be done later using chckconfig which updates the runlevel information for system services. If required stop the daemon -t, -add the service, run -list to ensure this was successful then start rmmagentd from /etc/init.d or service rmmagent start
# rmmagentd -t |
# chkconfig --add rmmagent |
# chkconfig --list rmmagent |
# /etc/init.d/rmmagent start |
For example:
# ./rmmagentd -t Process rmmagentd [11155] terminated # chkconfig --add rmmagent # chkconfig --list rmmagent rmmagent 0:off 1:off 2:on 3:on 4:on 5:on 6:off # /etc/init.d/rmmagent start # ./rmmagentd -t Process rmmagentd [11155] terminated # /etc/init.d/rmmagent start Starting rmmagentd: [ OK ] |
Once configured, the Linux Monitoring Agent may be controlled using the start and stop service commands with details of the usage available from info.
# service rmmagent start |
# service rmmagent stop |
# service rmmagent info |
[root@localhost rmmagent]# service rmmagent stop Shutting down rmmagentd: [ OK ] [root@localhost rmmagent]# service rmmagent start Starting rmmagentd: [ OK ] [root@localhost rmmagent]# service rmmagent info Usage: /etc/init.d/rmmagent {start|stop|status|restart} |
Please be aware that some Debian systems (for example Ubuntu 12.04) do not have chkconfig installed by default and this can either be installed using the following command at the CLI when logged on as a root or with update-rc.d
# apt-get install chkconfig |
To add the rmmagent with update-rc.d use defaults which sets the default runlevels and the rc*.d directories can then be queried to determine whether this was successful.
Using the below Find command will return K where the service is stopped and S when started at that runlevel with the following numbers indicating the order within that runlevel directory the script will be run by init.
# update-rc.d rmmagent defaults |
# find /etc/rc*.d/ -name *rmmagent*|grep rc|sort |
For example:
debian:/usr/local/rmmagent# ./rmmagentd -t Process rmmagentd [32632] terminated debian:/usr/local/rmmagent# update-rc.d rmmagent defaults Adding system startup for /etc/init.d/rmmagent ... /etc/rc0.d/K20rmmagent -> ../init.d/rmmagent /etc/rc1.d/K20rmmagent -> ../init.d/rmmagent /etc/rc6.d/K20rmmagent -> ../init.d/rmmagent /etc/rc2.d/S20rmmagent -> ../init.d/rmmagent /etc/rc3.d/S20rmmagent -> ../init.d/rmmagent /etc/rc4.d/S20rmmagent -> ../init.d/rmmagent /etc/rc5.d/S20rmmagent -> ../init.d/rmmagent debian:/# find /etc/rc*.d/ -name *rmmagent*|grep rc|sort /etc/rc0.d/K20rmmagent /etc/rc1.d/K20rmmagent /etc/rc2.d/S20rmmagent /etc/rc3.d/S20rmmagent /etc/rc4.d/S20rmmagent /etc/rc5.d/S20rmmagent /etc/rc6.d/K20rmmagent debian:/usr/local/rmmagent# /etc/init.d/rmmagent start Starting daemon: rmmagentd. debian:/usr/local/rmmagent# ./rmmagentd -s Service rmmagentd [32668] started |
Please be aware that where not set to run as a service the Linux Monitoring Agent must be manually started after a reboot.