helm/base/arch-desktop/bin/rsl

23 lines
471 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
# Run resilio (bittorrent sync) from $HOME if it isn't running. Otherwise, open
# its gui in the browser.
if command -v xdg-open >/dev/null; then
open=xdg-open
elif command -v open >/dev/null; then
open=open
elif [[ -n $BROWSER ]]; then
open=firefox
else
>&2 echo "No program to open urls with"
fi
if ! pgrep rslsync >/dev/null; then
pushd $HOME >/dev/null
rslsync &
popd >/dev/null
fi
[[ -t 0 ]] && $open http://localhost:8888/gui/