Hi,
A reboot script is not the most straightforward, but here it is. This is compatible with the weavedconnectd 1.3-07v package.
#!/bin/bash
#
# remot3.it Bulk Management Script
#
# Reboot Pi
# compatible with weavedconnectd package 1.3-07v
#
# $1 parameter is the jobID used for completion status
#
# $2 parameter is the API server to use for completion status
#
VERSION="0.0.3"
MODIFIED="November 22, 2017"
TOOL_DIR="/usr/bin"
source "$TOOL_DIR"/weavedlibrary
###############################################################
# this takes the place of the function in weavedlibrary which was written
# for a different version
prepare_and_reboot()
{
if [ ! -d "/root/.remot3.it" ]; then
mkdir "/root/.remot3.it"
fi
# save command and parameters for pass of uncompleted command through reboots
# cron reboot job needs to be in place to scan and execute commands left in the file above
REBOOTFILE=/root/.remot3.it/reboot.sh
echo "#!/bin/bash" > "$REBOOTFILE"
echo "# REBOOT DEVICE" >> "$REBOOTFILE"
echo "source /usr/bin/remot3_script_lib" >> "$REBOOTFILE"
echo "source /usr/bin/weavedlibrary" >> "$REBOOTFILE"
echo "wait_for_internet" >> "$REBOOTFILE"
echo "sleep 5" >> "$REBOOTFILE"
echo "${TOOL_DIR}/task_notify.sh a $1 $2 'Rebooted.'" >> $REBOOTFILE
echo "${TOOL_DIR}/task_notify.sh 1 $1 $2 'Job Complete'" >> $REBOOTFILE
echo "cronRemoveLine '@reboot bash -x $REBOOTFILE >> /tmp/rebootlog'" >> $REBOOTFILE
echo "rm $REBOOTFILE" >> $REBOOTFILE
chmod +x $REBOOTFILE
cronAddLine "@reboot bash -x $REBOOTFILE >> /tmp/rebootlog"
sync
sleep 2
/sbin/reboot
}
echo "--- Reboot Pi ---" > /tmp/"$0".txt
# this would be the place to add anything else you wanted to do prior to rebooting
# say rebooting
ret=$(${TOOL_DIR}/task_notify.sh a $1 $2 "Rebooting...")
#
prepare_and_reboot $1 $2