Fix startup command and simplify.
This commit is contained in:
parent
fd0fedd695
commit
256663c4f0
1 changed files with 18 additions and 10 deletions
|
@ -1,19 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$SETSID" != '1' ]; then
|
||||
SETSID=1 setsid "$0" "$@" &
|
||||
exit 0
|
||||
fi
|
||||
set -ex
|
||||
|
||||
if pgrep syncthing; then
|
||||
exit 0
|
||||
fi
|
||||
log_s() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
: "${HOME:=/}"
|
||||
SYNCTHING_HOME=/mnt/onboard/.adds/syncthing
|
||||
|
||||
# add 127.0.0.1 to loopback device
|
||||
ip addr add 127.0.0.1/32 dev lo || true
|
||||
|
||||
/usr/local/syncthing/syncthing serve --no-browser --no-restart --logflags=0 \
|
||||
--no-default-folder --home="$SYNCTHING_HOME"
|
||||
exit $?
|
||||
# don't start if its already running
|
||||
if pgrep syncthing; then
|
||||
log_s Syncthing is already running, exiting
|
||||
exit 0
|
||||
fi
|
||||
log_s Syncthing home is "SYNCTHING_HOME"
|
||||
log_s Starting Syncthing
|
||||
HOME="$HOME" setsid sh -c "/usr/local/syncthing/syncthing serve --no-browser --no-restart --logflags=0 \
|
||||
--no-default-folder --home='$SYNCTHING_HOME'"
|
||||
|
||||
code=$?
|
||||
log_s Syncthing exited with code $code
|
||||
exit $code
|
||||
|
|
Loading…
Reference in a new issue