#!/usr/bin/env bash

if ! ps aux | grep '[0-9] [s]yncthing$' ; then
    echo no syncthing running
    tmu -e syncthing syncthing syncthing
else
    echo synthing running, not starting
fi

if ! ps aux | grep ' [s]yncthing-tray' ; then
    echo no syncthing-tray running
    tmu -e syncthing syncthing-tray "syncthing-tray -api '${SYNCTHING_API_KEY}'"
else
    echo syncthing-tray running, not starting
fi
