Required Commands for creating your own Bulk Script (Python):

When writing any scripts to be executed by the Remote.It scripting feature, you MUST send notifier to signal the start of script execution on the device and a notifier to signal the end of execution with either a success or failure. Optionally you can also send information which can affect the Status Columns.connectd_task_notify requires four arguments:
connectd_task_notify[cmd][task_id][api][status]
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[1] to "[task_id]" and sys.argv[2] to "[api]"- you will never need to change the values of [task_id] and [api].

Example:

This command will return "Hello remote.it" to Status Column A on the remote.it portal 

import sys 
import subprocess
subprocess.Popen(["/usr/bin/connectd_task_notify", "a", sys.argv[1], sys.argv[2], "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)  

Cmd : Tells connnectd_task_notify what to update:

a.) 0-2: sends an update status to the job server
- Pass in 0 to cmd to update status (usually not needed)
- 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 or 2 as the argument for [cmd]. This signals 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.

 

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