"/bin/sh: 1: [[: not found". Delays start-up

This error is new for me since 0.37, it stems from this part of my config:

  - platform: command_line
    command: if [[ $(ps ax | grep -v grep | grep syncthing | wc -l) -eq 0 ]]; then echo "0"; else echo "1"; fi
    name: Syncthing
    payload_on:  1
    payload_off: 0

The command worked in 0.36 and works at a command prompt.

Something simple I’m missing?

On first glance I would say use quotes around the command.

1 Like

BTW: instead of

grep -v grep | grep syncthing

you can use

grep [s]yncthing

to save one of the grep calls.

Sebastian

1 Like

Thanks!

Now, looks like:

  - platform: command_line
    command: 'if [[ $(ps ax | grep [s]yncthing | wc -l) -eq 0 ]]; then echo "0"; else echo "1"; fi'
    name: Syncthing
    payload_on:  1
    payload_off: 0

Thought it was working but I think it stems from a problem somewhere else, I’ll have to take a closer look.

Thanks!

I’ve changed it to your way now, much tidier.

I reckon I’ve a snag somewhere else.