chore: update .gitignore and untrack bot.pid, update bot.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ target/
|
||||
*.class
|
||||
*.jar
|
||||
*.log
|
||||
*.pid
|
||||
.env
|
||||
data/
|
||||
downloads/
|
||||
|
||||
@@ -46,9 +46,24 @@ do_start() {
|
||||
# Kill any stale tmux session
|
||||
tmux kill-session -t "$TMUX_SESSION" 2>/dev/null
|
||||
|
||||
# Build env string from .env for tmux (since tmux doesn't inherit exports)
|
||||
local ENV_EXPORTS=""
|
||||
if [ -f "$BOT_DIR/.env" ]; then
|
||||
while IFS='=' read -r key value; do
|
||||
# Skip comments and empty lines
|
||||
[[ "$key" =~ ^#.*$ || -z "$key" ]] && continue
|
||||
# Remove surrounding quotes from value
|
||||
value="${value%\"}"
|
||||
value="${value#\"}"
|
||||
value="${value%\'}"
|
||||
value="${value#\'}"
|
||||
ENV_EXPORTS+="export ${key}='${value}'; "
|
||||
done < "$BOT_DIR/.env"
|
||||
fi
|
||||
|
||||
# Start bot inside a detached tmux session (UTF-8 for Thai text)
|
||||
tmux new-session -d -s "$TMUX_SESSION" \
|
||||
"cd '$BOT_DIR' && LANG=C.UTF-8 LC_ALL=C.UTF-8 exec java -Dfile.encoding=UTF-8 -jar '$JAR_FILE' >> '$LOG_DIR/console.log' 2>&1"
|
||||
"cd '$BOT_DIR' && ${ENV_EXPORTS}LANG=C.UTF-8 LC_ALL=C.UTF-8 exec java -Dfile.encoding=UTF-8 -jar '$JAR_FILE' >> '$LOG_DIR/console.log' 2>&1"
|
||||
|
||||
sleep 3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user