Files
simplexmq/scripts/docker/entrypoint-smp-server
sh 0f7ede5eed docker+scripts: XFTP servers installation, update docs, install scripts (#750)
* docker: major overhaul with xftp support

* github: update docker actions

* install: add installation scripts

* readme: update readme to reflect latest changes
2023-05-12 10:45:04 +01:00

36 lines
970 B
Bash
Executable File

#!/usr/bin/env sh
confd="/etc/opt/simplex"
logd="/var/opt/simplex/"
# Check if server has been initialized
if [ ! -f "$confd/smp-server.ini" ]; then
# If not, determine ip or domain
case "$ADDR" in
'') printf "Please specify \$ADDR environment variable.\n"; exit 1 ;;
*[a-zA-Z]*)
case "$ADDR" in
*:*) set -- --ip "$ADDR" ;;
*) set -- -n "$ADDR" ;;
esac
;;
*) set -- --ip "$ADDR" ;;
esac
# Optionally, set password
case "$PASS" in
'') set -- "$@" --no-password ;;
*) set -- "$@" --password "$PASS" ;;
esac
# And init certificates and configs
smp-server init -y -l "$@"
fi
# Backup store log just in case
[ -f "$logd/smp-server-store.log" ] && cp "$logd"/smp-server-store.log "$logd"/smp-server-store.log."$(date +'%FT%T')"
# Finally, run smp-sever. Notice that "exec" here is important:
# smp-server replaces our helper script, so that it can catch INT signal
exec smp-server start +RTS -N -RTS