33 lines
654 B
Bash
33 lines
654 B
Bash
#!/bin/bash
|
|
shopt -s nullglob
|
|
|
|
if [[ -z "$SERVERPASSWORD" ]]; then
|
|
echo "Env Var SERVERPASSWORD is not set"
|
|
exit 0
|
|
fi
|
|
|
|
files=( ${SAVEDIR}/*.zip )
|
|
savefile=${files[0]}
|
|
if [[ -z "$savefile" ]]; then
|
|
echo "No .zip savefile found in save directory ${SAVEDIR}"
|
|
exit 0
|
|
fi
|
|
|
|
echo "Using savefile ${savefile}"
|
|
|
|
cmd="./ArchipelagoServer ${savefile} --port 38281 --password ${SERVERPASSWORD}"
|
|
if [[ -n "$HOST" ]]; then
|
|
cmd="${cmd} --host ${HOST}"
|
|
fi
|
|
if [[ -n "$PASSWORD" ]]; then
|
|
cmd="${cmd} --password ${PASSWORD}"
|
|
fi
|
|
$cmd
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
echo "Started Archipelago Server"
|
|
else
|
|
echo "Error: Failed to start server"
|
|
exit 0
|
|
fi
|