kemoverse/startup.sh
2025-06-11 22:29:06 -03:00

43 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
#Kemoverse - a gacha-style bot for the Fediverse.
#Copyright © 2025 Waifu
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as
#published by the Free Software Foundation, either version 3 of the
#License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU Affero General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see https://www.gnu.org/licenses/.
# Navigate to the project directory (optional)
cd "$(dirname "$0")"
# Activate virtual environment
source venv/bin/activate
# Start the bot
echo "Starting bot..."
python3 bot/bot_app.py &
# Save the bot PID so you can stop it later if needed
BOT_PID=$!
# Start the website
echo "Starting web server..."
python3 web/app.py &
# Save the web PID too
WEB_PID=$!
# On CTRL+C or termination, kill both
trap "echo 'Stopping...'; kill $BOT_PID $WEB_PID; exit" SIGINT SIGTERM
# Wait for both processes (if you want it to stay attached)
wait $BOT_PID $WEB_PID