Strategies for debugging Device Scripts

Even the most basic scripts should have a call at the end to "connectd_task_notify".

connectd_task_notify is part of the connectd package and gets installed to /usr/bin.  Its only purpose is to communicate from a Device Script back to our job servers to:

  • Display status info into status cells (optional)
  • Keep track of job execution status, primarily completed "OK" and completed with an identified failure.

Some of the supplied sample scripts may do this indirectly by calling a "Job_Complete" function, but look for that and you should see a call to connectd_task_notify.

If you need your scripts to work with both connectd and systems using the older deprecated weavedconnectd package, please see:

If your script crashes or exits prior to executing the final call to connectd_task_notify, then those tasks will stay in "running" mode until you cancel the job.

ssh to target

If you have a script which is doing this, it is often quite helpful to SSH to the target device while you run the script as you can often see messages displayed on the console indicating what has happened.

log results for review

Another very helpful strategy is to log results from your script for you to review later.  You can use the Linux "logger" command to send messages to the system log, or you can use a command such as:

echo "$variable" >> $0.log

Supposing your script ws called "" then your log messages would accumulate in the file:


Sending log messages to the system log using "logger" has the advantage that the debug messages will still be there after a reboot and you can see how your script execution relates to other system events that use the log (if that's helpful).  On the downside, you usually will want to use "grep" to filter out your messages.

Sending messages to a temporary log file has the advantage of only including the info you send, so it may be easier to zero in on the info you are looking for.  The possible downsides include the fact that files in /tmp disappear when your system reboots.

You can use both methods at once if desired.

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