Making scripts work with connectd and weavedconnectd

Bulk scripts include calls to a “NOTIFIER” script which is part of the base package.

For the weavedconnectd package (deprecated), that was /usr/bin/task_notify.sh.

For the current connectd package, that is /usr/bin/connectd_task_notify.

If you have both packages installed on devices in your account and want a script to work OK with either one (barring other differences), include this code near the top of the script:

TOOL_DIR="/usr/bin"
if [ -e ${TOOL_DIR}/connectd_task_notify ]; then
    NOTIFIER="connectd_task_notify"
elif [ -e ${TOOL_DIR}/task_notify.sh ]; then
    NOTIFIER="task_notify.sh"
fi
 
JobId="$1"
API="$2"

Now write your status command lines like this:

ret=$(${TOOL_DIR}/$NOTIFIER code "$JobId" "$API" "message")

code = 1: job completed OK
code = 2: job completed, but some failure was detected
code = a, b, c, d, or e: write the message to the appropriate status cell

The script will figure out which notifier script is present and use the correct one accordingly (preferring connectd if both packages are installed for some strange reason). The scripts themselves are functionally identical (for now). Only the name changed.