Interfacing with the remote.it portal
connectd_task_notify is a notification script that sends data back to the remote.it portal. This is used to signal the end state of a script (success or failure) as well as sending information to the Status Columns. The connectd_task_notify requires four arguments:
To target Status Column A - Status Column E: Pass in any letter "a"-"e" to "[cmd]"
To pass data to the remote.it portal: Pass in a value to "[status]"
IMPORTANT: Pass in sys.argv to "[task_id]" and sys.argv to "[api]"- you will never need to change the values of [task_id] and [api].
This command will return "Hello remote.it" to Status Column A on the remote.it portal
subprocess.Popen(["/usr/bin/connectd_task_notify", "a", sys.argv, sys.argv, "Hello remote.it"]).wait()
If you have the weavedconnectd package:
subprocess.Popen(["/usr/bin/task_notify.sh", "a", sys.argv, sys.argv, "Hello remote.it"]).wait()
In the example above:
We are passing "a" to "[cmd]", which targets Status Column A of the targeted device(s) in the remote.it portal.
We are passing the string "Hello remote.it" to "[status]", which will return the string to Status Column A of the device(s)
What is happening here:
Cmd : Tells connnectd_task_notify what to update:
a.) 0-2: sends an update status to the job server
- Pass in 1 to cmd to request for a completion status.
- Pass in a 2 to cmd to request for a failed status
b.) a-e (alternative: 3-7): represents alphabetical status
columns in the remote.it portal
The exact values translate to the following:
0 : update status
1 : completed status
2 : failed status
3 - 7 : status columns a-e
Status: This is the section containing the message that you want to be sent back to remote.it. With options a-e (alt: 3-7), the message will be sent to its corresponding status column (A-E) on the portal.
REMINDER: At the bottom of the script you must include a call to connectd_task_notify by passing in 1 as the argument for [cmd]. This tells the remote.it portal that the script has successfully completed. It will then change the status in the job list from “running” to “done.” Failure to do so will result in the “running” status being displayed until the job is canceled.