The Linux job fails even with a simple command such as env or ls in CA Automic Linux/Unix Agent

Document ID : KB000097952
Last Modified Date : 25/05/2018
Show Technical Document Details
Introduction:
Error message in the report log:
 
env: command not found...

or 


ls: command not found...


The Linux Agent is configured to automatically start when AWA Service Manager is
started. The AWA Service Manager is configured and started using SystemD.

Excerpt from the command "man systemd"
The SystemD is a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that brings up and maintains userspace services(taken from "man systemd"). The AWA Service Manager is configured to be started using SystemD on Linux and WPs and CPs are to start automiatically when the  AWA Service Manager is started. 


The issue is that the systemd configuration file is using $variable to a define a path, which is not allowed in the SystemD.
Environment:
Operating System: Linux or UNIX
Products: Service Manager and Linux Agent v10.x, v11.x or v12.x
Instructions:
When creating a service startup with SystemD, you need to define an environment variable or an environment file which contains all the environment variables. The issue is that the customer is using $variable to define an environment variable such as $LD_LIBRARY_PATH but with SytemD, it is not allowed as explained below.

Excerpt from the command "man systemd":
=========================================
Environment=
           Sets environment variables for executed processes. Takes a space-separated list of variable assignments. This option may be specified more than once in
           which case all listed variables will be set. If the same variable is set twice, the later setting will override the earlier setting. If the empty string is
           assigned to this option, the list of environment variables is reset, all prior assignments have no effect. Variable expansion is not performed inside the
           strings, however, specifier expansion is possible. The $ character has no special meaning. If you need to assign a value containing spaces to a variable,
           use double quotes (") for the assignment.

           Example:

               Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"

           gives three variables "VAR1", "VAR2", "VAR3" with the values "word1 word2", "word3", "$word 5 6".




Therefore, the configuration file used by the SystemD should use hard coded path and not use any $variable to define a path or reference to variable.