CA WA Agent can run scripts. If the script returns completion code 0 or success the job will be marked as complete.
When executing a script, it is always a best to have some debug messages enabled. When the script runs, the WA Agent will monitor the script. Any child processes that are spawned off through the script will not be visible. If the script returns an exit code of 0, then the WA Agent will mark the job as complete.
If the job is running a script then:
1. Manually run the script on the Agent machine using the exact same user and parameters as defined in the job.
2. Add debugging in scripts. It can vary between OS and shell. Here are some common examples that will enable additional output. It is recommended to consult the OS and shell manuals for more details on debugging.
Korn and Bash Shells:
Add set -x at the start of the script
#!/bin/bash
set -x
echo "Time is: `date +%H:%M`"
#EOF
The above script when executed will show each executed line:
[user1@linux ~]# ./time.sh
++ date +%H:%M
+ echo 'Time is: 17:16'
Time is: 17:16
In Windows, the @ECHO ON will provide similar output.
REM My-script.bat
@ECHO ON
if exist c:\temp\timbuktu.txt (
REM file exists
notepad c:\temp\timbuktu.txt
) else (
REM file doesn't exist
echo "File Misssing!!"
)
REM EOF
Output:
C:\Temp>my-sript.bat
C:\Temp>REM My-script.bat
C:\Temp>if exist c:\temp\timbuktu.txt (
REM file exists
NOTEPAD c:\temp\timbuktu.txt
) else (
REM file doesn't exist
echo "File Missing!!"
)
"File Missing!!"
C:\Temp>REM EOF
Note: If the script executes another binary, then output of that program may or may not show up. It is recommend to make sure such executables have been properly set with any environment variables or settings that may be needed.
Additional errors that may be reported