# Remot3\_script\_lib

**URL:** https://forum.remote.it/t/remot3-script-lib/122
**Category:** Troubleshooting
**Created:** [January 27, 2020, 1:12am UTC](https://forum.remote.it/t/remot3-script-lib/122 "2020-01-27T01:12:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![smagness](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@smagness](https://forum.remote.it/u/smagness)
#### Post date: [January 27, 2020, 1:12am UTC](https://forum.remote.it/t/remot3-script-lib/122/1 "2020-01-27T01:12:24Z")

</div>

We have a set of remote.it scripts working fine on Raspbian stretch, but want to move to Raspbian buster. When trying to install weavedconnectd on buster, I came across the following post: [https://github.com/alanbjohnston/CubeSatSim/wiki/Remote-Management-of-Raspberry-P](https://github.com/alanbjohnston/CubeSatSim/wiki/Remote-Management-of-Raspberry-P) (found after not being able to install weavedconnectd)

Installing connectd works fine, I can connect our RPi to the remote.it server and run scripts. The problem is that our scripts attempt to import:

```
. /usr/bin/remot3_script_lib-1.1

```

which no longer exists. We use the following methods from it:

- Translate
- Status\_\*
- Download\_With\_Retry
- Task\_Update
- Task\_Complete
- Task\_Failed

Is there a connectd equivalent wrapper to the underlying scripts? Or is there a way to update the wrapper to be agnostic to weaved vs connectd?

---

<div class="post-metadata">

### Author: ![smagness](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@smagness](https://forum.remote.it/u/smagness)
#### Post date: [January 27, 2020, 3:28am UTC](https://forum.remote.it/t/remot3-script-lib/122/2 "2020-01-27T03:28:53Z")

</div>

I notice the Send-File-Sample.sh example has some of these methods embedded within the script rather than as a separate ‘library’. Unfortunately I have no information about the history of the remot3\_script\_lib so I can only guess, but I think there are two possibilities:

- An earlier version of the weavedconnectd installation provided the Remot3\_script\_lib, for device scripts to make use of
- _We_ generated a common library of functions called Remot3\_script\_lib and installed/placed it in /usr/bin so we didn’t have to replicate code between all our device scripts

---

<div class="post-metadata">

### Author: ![gary](https://avatars.discourse-cdn.com/v4/letter/g/839c29/32.png) [@gary](https://forum.remote.it/u/gary)
#### Post date: [January 31, 2020, 3:03pm UTC](https://forum.remote.it/t/remot3-script-lib/122/3 "2020-01-31T15:03:09Z")

</div>

Hi,

Sorry for the delay but I really had to think about this one. The remot3\_script\_lib wound up in our package originally to support an OEM customer. They had tested it, but we hadn’t, so we removed it from the connectd package. If it is working for you that is a good sign so you can continue to use it.

You can take that file (from one of your weaved devices) and send it to your connectd devices using the “send file” script.

> **[Example: send a file to your device](https://support.remote.it/hc/en-us/articles/360046825411-Example-send-a-file-to-your-device)**
>
> Upload the script to your account
> Download the attached file to your system, then upload it to remote.it:
> Send-File-Sample.sh
> This script lets you pick a file from your storage area, which is then ...

To write scripts so that they will work both with weavedconnectd and connectd, include the following lines near the top (but not at the top) of your scripts. Make sure that TOOL\_DIR is defined prior to this, e.g.

```auto
# the following block is included to allow compatibility with both
# the deprecated weavedconnectd package as well as the current connectd package
TOOL_DIR=/usr/bin
if [-e "$TOOL_DIR"/task_notify.sh]; then
    NOTIFIERSCRIPT=task_notify.sh
elif [-e "$TOOL_DIR"/connectd_task_notify]; then
    NOTIFIERSCRIPT=connectd_task_notify
fi

```

If TOOL\_DIR is already defined then you don’t need to redefine it, but make sure that definition is BEFORE the block of code above.

Then, in your code, you’ll need to replace any calls to /usr/bin/task\_notify.sh to ${TOOL\_DIR}/"$NOTIFIERSCRIPT", e.g.

```auto
Status()
{
	ret=$(${TOOL_DIR}/"$NOTIFIERSCRIPT" $1 $api $jobID "$2")	
}

# first, clear status cells a through e
Status a ""
Status b ""
Status c ""
Status d ""
Status e ""

```

Let me know if you have any issues getting this all to work.

---

<div class="post-metadata">

### Author: ![smagness](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@smagness](https://forum.remote.it/u/smagness)
#### Post date: [February 2, 2020, 7:58pm UTC](https://forum.remote.it/t/remot3-script-lib/122/4 "2020-02-02T19:58:29Z")

</div>

We took the methods from the example scripts on your website (specifically the file transfer example), diffed them with the methods in remote3\_script\_lib and found there were fairly minimal differences - including your suggestion for the $NOTIFIERSCRIPT var.

Unfortunately I don’t have enough rep to upload files, otherwise I’d have attached our version of the script\_lib for others to use.

Thanks for your help!

---

<div class="post-metadata">

### Author: ![gary](https://avatars.discourse-cdn.com/v4/letter/g/839c29/32.png) [@gary](https://forum.remote.it/u/gary)
#### Post date: [February 3, 2020, 4:32pm UTC](https://forum.remote.it/t/remot3-script-lib/122/5 "2020-02-03T16:32:54Z")

</div>

So, are you good to go now? Another thing you can do is simply to include all of the functions from the library file in your script itself, which removes the dependency on a specific external library.

---

<div class="post-metadata">

### Author: ![smagness](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@smagness](https://forum.remote.it/u/smagness)
#### Post date: [February 3, 2020, 7:38pm UTC](https://forum.remote.it/t/remot3-script-lib/122/6 "2020-02-03T19:38:29Z")

</div>

Yep, we’re all good now, thanks for the help.

We didn’t really want to include the functions in the script as we have multiple separate scripts and copying code is always a bad sign!

---

<div class="post-metadata">

### Author: ![gary](https://avatars.discourse-cdn.com/v4/letter/g/839c29/32.png) [@gary](https://forum.remote.it/u/gary)
#### Post date: [February 5, 2020, 7:22pm UTC](https://forum.remote.it/t/remot3-script-lib/122/7 "2020-02-05T19:22:54Z")

</div>

Fair enough. You could also develop and install your own set of library functions into a file to be included when other scripts run, and use a simpler script to install them.
