We want to manually install and run the APM Infrastructure Agent as non root - how can we run this as a service

Document ID : KB000129142
Last Modified Date : 12/03/2019
Show Technical Document Details
Introduction:
When installng the APM Infrastructure Agent it creates a crontab entry for the user running the install optiion - (see doc reference)

https://docops.ca.com/ca-apm/10-7/en/implementing-agents/infrastructure-agent/install-the-infrastructure-agent#InstalltheInfrastructureAgent-InstallandStarttheInfrastructureAgent

we do not wish to run it that way is there another option.

 
Environment:
APMIA 10.7, RHEL 7.x
Instructions:
If the APMIA has not been installed and a service craeted then it can be started using the force_start option and this can be incorporated into a service start script. The following shows an example of this working

Create a startup script in /etc/.init/d and give it execute permission - in the example it is called apmia contents as below. In this example the user that owns and runs the APMIA is introscp and the script is defined to run in run levels 3,4 & 5

#!/bin/bash
# chkconfig: 345 25 75

# change to location where apmia is located
cd /home/introscp/apmia 

case $1 in
         start)
         su introscp -c "./apmia-ca-installer.sh force_start"
         ;;
         stop)
         su introscp -c "./apmia-ca-installer.sh stop"
         ;;
         status)
         su introscp -c "./apmia-ca-installer.sh status"
         ;;
         *) echo "usage apmia start|stop|status"
esac


When the service status is interrogated after system start we can see it running as the descired user

# service apmia status
APM Infrastructure Agent 2154 running
# ps -ef |grep Unified
introscp 2154 2152 3 21:13 ? 00:00:05 /home/introscp/apmia/jre/bin/java -server -Xms256m -Xmx512m -XX:ErrorFile=logs/jvm_error.%p.log -jar /home/introscp/apmia/lib/UnifiedMonitoringAgent.jar


Please note this is an example of what can be done and is not provided as an offically supported mechanism and has not undergone official testing.