Files
simplexmq/scripts/docker/entrypoint-xftp-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
1018 B
Bash
Executable File

#!/usr/bin/env sh
confd="/etc/opt/simplex-xftp"
logd="/var/opt/simplex-xftp"
# Check if server has been initialized
if [ ! -f "$confd/file-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
# Set quota
case "$QUOTA" in
'') printf "Please specify \$QUOTA environment variable.\n"; exit 1 ;;
*) set -- "$@" --quota "$QUOTA" ;;
esac
# Init the certificates and configs
xftp-server init -l -p /srv/xftp "$@"
fi
# Backup store log just in case
[ -f "$logd/file-server-store.log" ] && cp "$logd"/file-server-store.log "$logd"/file-server-store.log."$(date +'%FT%T')"
# Finally, run xftp-sever. Notice that "exec" here is important:
# smp-server replaces our helper script, so that it can catch INT signal
exec xftp-server start +RTS -N -RTS