Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. #
  3. # redeploy.sh — trigger a remote deploy FROM YOUR LAPTOP (Git Bash).
  4. # It SSHes into the server and runs the server-side ./deploy.sh.
  5. #
  6. # Usage:
  7. # ./redeploy.sh # pull latest + rebuild
  8. # ./redeploy.sh --no-pull # rebuild current checkout
  9. # ./redeploy.sh --rollback # restore newest backup on the server
  10. #
  11. # Password (in priority order):
  12. # 1. $DEPLOY_PASS environment variable
  13. # 2. a gitignored `deploy.secret` file next to this script (one line = the pw)
  14. # 3. hidden prompt
  15. set -euo pipefail
  16. HOST=118.95.33.89
  17. PORT=61
  18. USER=root
  19. APPDIR=/opt/bizgaze-support
  20. DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  21. # Locate plink (PuTTY).
  22. PLINK="$(command -v plink 2>/dev/null || true)"
  23. [ -n "$PLINK" ] || PLINK="/c/Program Files/PuTTY/plink"
  24. [ -x "$PLINK" ] || { echo "ERROR: plink not found (install PuTTY or add to PATH)"; exit 1; }
  25. # Resolve password.
  26. PW="${DEPLOY_PASS:-}"
  27. if [ -z "$PW" ] && [ -f "$DIR/deploy.secret" ]; then
  28. PW="$(tr -d '\r\n' < "$DIR/deploy.secret")"
  29. fi
  30. if [ -z "$PW" ]; then
  31. read -rsp "Server password for $USER@$HOST: " PW; echo
  32. fi
  33. echo "==> Triggering deploy on $USER@$HOST ($APPDIR) …"
  34. exec "$PLINK" -ssh -batch -P "$PORT" -pw "$PW" "$USER@$HOST" "cd $APPDIR && bash deploy.sh $*"