Question: - Why a script completed successful when executed manually on Operating System but failed when submit through Control-M/Agent as a job? For example, When a user login to UNIX machine and run the script manually, it completed successful. However, when the Control-M job which is defined using the same user as the "Run As" account to run the same script, this job will failed and ended NOTOK when executed by the Control-M /Agent. |
Answer: - Ensure that the environmental setting is the same when running the script manually and submit through Control-M/Agent. On a UNIX or Linux machine: 1. Ensure that the UNIX Operating System (OS) Account used to run the job manually is the same user as the "Run As / Owner" User 2. Get the environmental setting when the user is log on manually on the machine to execute the job - Log on to the machine using the UNIX Account - Run the script and review the sysout to confirmed that the job completed successfully. - Run the following UNIX command to display the environmental setting used to run the script 5. Create a Control-M Command Type Job to get the environment setting when job submitted through Control-M/Agent - Create a simple Control-M Command Type job to run the modified script - Define this job to have the Run As with the same UNIX Account used in Step 2 - Run the Control-M Job to get the environmental setting output 6. Compare the environment setting output of Step 2, 4 and 5. - If there are any environment variable missing or difference, do modify the Control-M Job or script as required to add the missing environmental variable. (Do discuss with the script developer if required assistance to modify the script.) 7. Repeat Step 5 and 6 to ensure that the "environmental setting" is configured correctly 8. Run the Control-M Job with the script that fails previously If the above failed to resolve this incident, provide the following information to Control-M Support Team for investigation: - Send the installed-versions.txt of the Control-M Agent - Send the environment setting captured in Step 2, 4 and 5 - Send the sysout / output of the job when executed manually and through Control-M - What is the "Run As" User used for the Control-M Job? - Send the script, Control-M Log and Job Name for the failed Control-M Jobs - Is the Control-M Agent running in root or non-root mode? On the Windows machine: - Log on to the machine using the RunAs Account - Run the script and review the sysout to confirmed that the job completed successfully. - Run the following Windows command to display the environmental setting used to run the script 2. 3. 4. Create a Control-M Command Type Job to get the environment setting when job submitted through Control-M/Agent - Create a simple Control-M Command Type job to run the modified script - Define this job to have the Run As with the same Windows Account used in Step 3 - Run the Control-M Job to get the environmental setting output 5. Compare the environment setting output of Step 1, 3 and 4. - If there are any environment variable missing or difference, do modify the Control-M Job or script as required to add the missing environmental variable. (Do discuss with the script developer if required assistance to modify the script.) 6. Repeat Step 4 and 5 to ensure that the "environmental setting" is configured correctly 7. Run the Control-M Job with the script that fails previously Additional Information: Following is an example for this troubleshooting procedure: - When the script is executed manually: Tthe following variable in the environmental setting are set to zh_CN.utf8: LC_CTYPE=zh_CN.utf8 LANG=zh_CN.utf8 - When the same script is submitted through the Control-M Agent: The following variables are set when running the "env" via a Control-M Job: LC_CTYPE=zh_CN.utf8 LANG=zh_CN.utf8 LC_ALL= LC_COLLATE=C - Comparing the environment variables setting for both situation: The following environmental variable are not defined: LC_ALL LC_COLLATE - There the solution is to set these "extra" variable to zh_CN.utf8 or remove them from the environmental file. |