DelayNoMore/battle_srv/start_daemon.sh

23 lines
504 B
Bash
Raw Normal View History

2022-09-20 15:50:01 +00:00
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 [TEST|PROD]"
exit 1
fi
basedir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
2022-12-18 08:48:33 +00:00
PROJECTNAME=server.exe
2022-09-20 15:50:01 +00:00
OS_USER=$USER
ServerEnv=$1
LOG_PATH="/var/log/treasure-hunter.log"
# Make sure that the following "PidFile" is "git ignored".
PID_FILE="$basedir/treasure-hunter.pid"
sudo su - root -c "touch $LOG_PATH"
sudo su - root -c "chown $OS_USER:$OS_USER $LOG_PATH"
2022-12-18 08:48:33 +00:00
ServerEnv=$ServerEnv $basedir/$PROJECTNAME >$LOG_PATH 2>&1 &
2022-09-20 15:50:01 +00:00
echo $! > $PID_FILE