Example: show device status

Download the following file to your PC, then upload it to remote.it:

 Get-Pi-Status.sh

This script returns the following info into status columns A through E:

  • Operating System name

  • Linux Version (uname -a command)

  • Uptime (time since last reboot)

  • Number of installed remote.it Services

  • Version of of the installed connectd or remoteit package

 

If you are on Windows, editing this file in Notepad will cause issues because the line feeds are not compatible with your Pi's Linux OS. We suggest you use a Linux compatible text editor for Windows such as Notepad++.

In the script, the /usr/bin/connectd_task_notify script is used to report various interesting bits of info about your systems. /usr/bin/connectd_task_notify is installed when you install the remoteit or connectd packages. The variables TOOL_DIR and NOTIFIER are used for this purpose.

TOOL_DIR="/usr/bin" 
NOTIFIER="connectd_task_notify"

For example, the OS Name is reported in Status column A. paramter 1 = a.

# Update status column A (StatusA) in remote.it portal
#-------------------------------------------------
# retrieve the os ID as reported by the command “cat /etc/os-release”
os=$(cat /etc/os-release | grep -w ID | awk -F "=" '{print $2 }')
# send to status column a in remot3.it portal
ret=$(${TOOL_DIR}/$NOTIFIER a $1 $2 $os)
The call shown below to the $NOTIFIER script with parameter1 = 1 is used to indicate successful execution of the script.  this script does not have any failure exit codes, but those could be added depending on what you are doing.
#---- You MUST use the final line:
ret=$(${TOOL_DIR}/$NOTIFIER 1 $1 $2 "Job complete")
It may take several minutes for the Job Status to fully update and clear, even after running a script which by itself completes rapidly.
========
 
Was this article helpful?
0 out of 0 found this helpful