Register the Linux Agent as an auto-start service

Registering the Linux Agent as an auto-start service ensures the Agent automatically starts with the computer, rather than manually started after every reboot.

How this is achieved depends on the Linux distribution and supported service management tool. The below commands require root permissions to execute.

SysVinit (chkconfig)

SysVinit uses the chkconfig utility to specify the run level to start the Linux Agent service in.

  1. Check the current rmmagent service run levels (on or off) using chkconfig --list. Include | grep rmmagent to limit the results to the Linux Monitoring Agent service.
  2. Auto-start is Runlevel 3.

    chkconfig --list rmmagent

    For example

    # chkconfig --list rmmagent
    rmmagent       0:off   1:off  2:off   3:off   4:off   5:off   6:off

    This output shows SysV services only and does not include native systemd services please follow the systemd steps below

     

  3. Where runlevel 3 is off, use the -add command to configure the service to automatically restart during a system reboot.
  4. chkconfig --add rmmagent

  5. Once complete, rerun the --list command to ensure the -add action was successful.
  6. # chkconfig --add rmmagent
    # chkconfig --list rmmagent
    rmmagent        0:off   1:off   2:on    3:on    4:on    5:on    6:off

Debian Note (chkconfig and update-rc.d)

Not all Debian distributions have the chkconfig installed by default (for example Ubuntu 12.04).

Either install chkconfig via AptGet and follow the above SysVinit steps or use update-rc.d.

# apt-get install chkconfig

Using update-rc.d to set the runlevel.

  1. Set the service to start with the default runlevel.
  2. update-rc.d rmmagent defaults

    # 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

     

  3. Query the rc*.d directories to determine whether this was successful (K = Stopped, S = Started)
  4. find /etc/rc*.d/ -name *rmmagent*|grep rc|sort

    # 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

Systemd

The systemd suite of tools is responsible for controlling the management of services (started, stopped, behavior after a reboot etc). Systemd was adopted as a replacement for SysVinit in a number of distributions including Centos (17.14.04 +), Debian (8 +), Fedora (15 +), openSUSE (12.2 +), Red Hat Enterprise Linux (12 +), Ubuntu (15.04 +).

  1. Check the current rmmagent service runlevels (enable or disable) using systemctl list-unit-files --type=service. Include | grep rmmagent to limit the results to the Linux Monitoring Agent service.
  2. systemctl list-unit-files --type=service | grep rmmagent

    # systemctl list-unit-files --type=service | grep rmmagent
    rmmagent.service disabled

     

  3. Where the service is disabled, use the enable command to automatically restart the service during a system reboot:
  4. systemctl enable rmmagent

    # systemctl enable rmmagent 
    Created symlink from /etc/systemd/system/multi-user.target.wants/rmmagent.service to /etc/systemd/system/rmmagent.service

  5. Once complete, run the status command both before and after a reboot to ensure the enable action was successful
  6. systemctl status rmmagent

    # systemctl enable rmmagent
    Created symlink from /etc/systemd/system/multi-user.target.wants/rmmagent.service to /etc/systemd/system/rmmagent.service
    # systemctl status rmmagent
    rmmagent.service - Advanced Monitorng Agent
    Loaded: loaded (/etc/systemd/system/rmmagent.service; enabled; vendor preset: disabled)
    Active: active (running) since Tue 2017-12-05 16:12:41 GMT; 17 min ago
    Process: 1093 ExecStart=/usr/local/rmmagent/rmmagentd -ss (code=exited, status=0/SUCCESS)
    Main PID: 1123 (rmmagentd)
    CGroup: /system.slice/rmmagent/rmmagentd -ss

    1123 /usr/local/rmmagent/rmmagentd -ss
    Dec 05 16:12:40 localhost.localdomain systemd[1]: Starting Advacned Monitorin...
    Dec 05 16:12:40 localhost.localdomain systemd[1]: Started Advacned Monitoring...
    Hint: Some lines were ellipsized, use -l to show in full.

Please note that we are not responsible for the content of external sites.

What do you want to do?