mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-31 03:16:07 +00:00
* docker: major overhaul with xftp support * github: update docker actions * install: add installation scripts * readme: update readme to reflect latest changes
36 lines
1018 B
Bash
Executable File
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
|
|
|