Debugging: Script Techniques

Write intermediate values to Status Columns

You can use the "connectd_task_notify" script, or functions in the sample scripts to display information in the Status Columns to help you debug your scripts.  If you really need to make sure you see the value, add a "sleep" command to your script after writing to the Status Column.  The sleep command will pause the execution of the script for the given number of seconds.

# Status column A
ret=$(usr/bin/connectd_notify a $jobid $api_server "$1")
Status_A "Variable: $variable"


  • Use the "Log()" function shown in several of the examples.  This writes selected information into a log file in the $DEBUG_DIR folder.  This information will not be stored if the device is rebooted.
# log to /tmp if DEBUG_ON is set
if [ $DEBUG_ON -gt 0 ]; then
echo "$ts $1" >> ${DEBUG_DIR}/$(basename $0).log

# end of script
  • Use the "logger" command to write values to the syslog.  This information will generally be stored in the syslog and its backup files if the device is rebooted.

Use "" to execute a Bulk Script in shell debug mode

If your script terminates unexpectedly, it can be very difficult to debug.  You should comment out all calls to "Job_Complete" or "Job_Failed" temporarily.  Both "Job_Complete" and "Job_Failed" reset the Task Server for the given Task ID.  You want to make sure that the Task Server stays open until you're done debugging. 

Download and copy it to your device at /usr/bin.


Was this article helpful?
0 out of 0 found this helpful