# Run ex-bond-issuance automation from command line

**URL:** <https://forum.canton.network/t/run-ex-bond-issuance-automation-from-command-line/1792>\
**Category:** App Development\
**Tags:** json-api, react, sandbox\
**Created:** [December 14, 2020, 10:06pm UTC](https://forum.canton.network/t/run-ex-bond-issuance-automation-from-command-line/1792 "2020-12-14T22:06:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesljaworski85](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/jamesljaworski85/32/385_2.png) [@jamesljaworski85](https://forum.canton.network/u/jamesljaworski85)\
**Post date:** [December 14, 2020, 10:06pm UTC](https://forum.canton.network/t/run-ex-bond-issuance-automation-from-command-line/1792/1 "2020-12-14T22:06:56Z")

</div>

Hey DAMLer’s!

After exploring `ex-bond-issuance` repo and after talking to @Richard_Kapolnai, I do want to try and incorporate the triggers in the repo. I was previously going to try and incorporate without the automation but the triggers seem pretty slick and I want to give them a shot.

Earlier, I got things up and running in Standalone from the windows command line with the help of @Gary_Verhaegen and @cocreature. These were the steps we cam up with:

```
python scripts/getfinlib.py 1.7.0
daml build -o target/bond-issuance.dar
daml start --sandbox-option --address=localhost --sandbox-option -w --open-browser no
## insert manual 'make automation' steps here
daml codegen js target/bond-issuance.dar -o daml.js
daml codegen js target/finlib-1.7.0.dar -o daml.js
cd ui-js
yarn install
set NODE_ENV=development
yarn start

```

I’d like to now add the `make automation` steps to the sequence. From the `Makefile`, the steps are:

```
.PHONY: automation
automation:
  JAVA_TOOL_OPTIONS=-Xmx128m \
  scripts/waitForSandbox.sh localhost 6865 && \
  scripts/startTriggers.sh localhost 6865 target/bond-issuance.dar

```

My guess is that they would look something like this:

> ```
> set JAVA_TOOL_OPTIONS=-Xmx128m 
> java scripts/waitForSandbox.sh localhost 6865
> java scripts/startTriggers.sh localhost 6865 target/bond-issuance.dar
> 
> ```

When I do this, this is the result:

> ```
> C:\Users\James Jaworski\OneDrive\Optimis\bloqbook-v2\ex-bond-issuance-master>set JAVA_TOOL_OPTIONS=-Xmx128m
> C:\Users\James Jaworski\OneDrive\Optimis\bloqbook-v2\ex-bond-issuance-master>java scripts/waitForSandbox.sh localhost 6865
> Picked up JAVA_TOOL_OPTIONS: -Xmx128m
> Error: Could not find or load main class scripts.waitForSandbox.sh
> 
> ```

It looks like the environment variable is being set, but the rest is not running. Is anyone familiar with running this type of command on a Windows machine? My version of java is:

> ```
> C:\Users\James Jaworski\OneDrive\Optimis\bloqbook-v2\ex-bond-issuance-master>java -version
> Picked up JAVA_TOOL_OPTIONS: -Xmx128m
> java version "1.8.0_231"
> Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
> Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
> 
> ```

Thanks!

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [December 15, 2020, 9:16am UTC](https://forum.canton.network/t/run-ex-bond-issuance-automation-from-command-line/1792/2 "2020-12-15T09:16:32Z")

</div>

Hi @jamesljaworski85, the `.sh` extension of the two scripts indicates that this is a shell script (more specifically bash). Running those using `java` is not going to work. Instead you have to look at the content of those scripts and translate it to powershell/cmd.exe commands.

`wait_for_sandbox.sh` doesn’t do anything except for waiting for Sandbox to start so the easiest option is probably to just wait until you see Sandbox starting up before you invoke the next command.

`startTriggers.sh` actually starts the triggers. If you look at the contents, you can see that it invokes the following 10 times for different triggers [ex-bond-issuance/startTriggers.sh at 9f801c393e8bd6be0a2a59105284521b8628e2a1 · digital-asset/ex-bond-issuance · GitHub](https://github.com/digital-asset/ex-bond-issuance/blob/9f801c393e8bd6be0a2a59105284521b8628e2a1/scripts/startTriggers.sh#L38,L47). Since triggers are long-running processes you need to invoke that from 10 different terminals replacing the DAR, the trigger name, the party and the ledger host and port in the command.

```haskell
  daml trigger \
      --wall-clock-time \
      --dar "${DAR_FILE}" \
      --trigger-name "$trigger_name" \
      --ledger-host "${SANDBOX_HOST}" \
      --ledger-port "${SANDBOX_PORT}" \
      --ledger-party "$party"

```

---

<div class="post-metadata">

**Author:** ![jamesljaworski85](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/jamesljaworski85/32/385_2.png) [@jamesljaworski85](https://forum.canton.network/u/jamesljaworski85)\
**Post date:** [December 15, 2020, 1:46pm UTC](https://forum.canton.network/t/run-ex-bond-issuance-automation-from-command-line/1792/3 "2020-12-15T13:46:46Z")

</div>

Thanks @cocreature. After reading that it would take 10 different command windows (in addition to the two others I already had running), I decided to download Gitbash and run it from there. I was able to get it up and running and work through some of the examples.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [December 15, 2020, 1:47pm UTC](https://forum.canton.network/t/run-ex-bond-issuance-automation-from-command-line/1792/4 "2020-12-15T13:47:34Z")

</div>

Glad to hear that you got it working!
