Implements git-based deployment workflow with three scripts: - setup-unraid.sh: One-time SSH and git configuration - deploy.sh: Automated deployment via git pull and docker compose - manage.sh: Remote management utilities (logs, restart, status) Configuration targets 192.168.2.61 at /mnt/user/docker/custom-dockers/discord-stock-bot 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# manage.sh - Manage discord-stock-bot on Unraid
|
|
|
|
UNRAID_HOST="${UNRAID_HOST:-192.168.2.61}"
|
|
REMOTE_PATH="/mnt/user/docker/custom-dockers/discord-stock-bot"
|
|
|
|
CMD="$1"
|
|
|
|
run_remote() {
|
|
ssh ${UNRAID_HOST} "cd ${REMOTE_PATH} && $1"
|
|
}
|
|
|
|
case "$CMD" in
|
|
logs)
|
|
run_remote "docker compose logs -f"
|
|
;;
|
|
status)
|
|
run_remote "docker compose ps"
|
|
;;
|
|
restart)
|
|
run_remote "docker compose restart"
|
|
echo "Bot restarted"
|
|
;;
|
|
stop)
|
|
run_remote "docker compose down"
|
|
echo "Bot stopped"
|
|
;;
|
|
start)
|
|
run_remote "docker compose up -d"
|
|
echo "Bot started"
|
|
;;
|
|
rebuild)
|
|
run_remote "docker compose up -d --build"
|
|
echo "Bot rebuilt and started"
|
|
;;
|
|
shell)
|
|
ssh -t ${UNRAID_HOST} "cd ${REMOTE_PATH} && bash"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {logs|status|restart|stop|start|rebuild|shell}"
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " logs - View live logs"
|
|
echo " status - Show container status"
|
|
echo " restart - Restart the bot"
|
|
echo " stop - Stop the bot"
|
|
echo " start - Start the bot"
|
|
echo " rebuild - Rebuild and restart the bot"
|
|
echo " shell - SSH into Unraid at bot directory"
|
|
exit 1
|
|
;;
|
|
esac
|