system.sh 575 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. cd /runtipi || echo ""
  3. # Ensure PWD ends with /runtipi
  4. if [[ $(basename "$(pwd)") != "runtipi" ]] || [[ ! -f "${BASH_SOURCE[0]}" ]]; then
  5. echo "Please make sure this script is executed from runtipi/"
  6. exit 1
  7. fi
  8. if [ -z ${1+x} ]; then
  9. command=""
  10. else
  11. command="$1"
  12. fi
  13. # Restart Tipi
  14. if [[ "$command" = "restart" ]]; then
  15. echo "Restarting Tipi..."
  16. scripts/stop.sh
  17. scripts/start.sh
  18. exit
  19. fi
  20. # Update Tipi
  21. if [[ "$command" = "update" ]]; then
  22. scripts/stop.sh
  23. git pull origin master
  24. scripts/start.sh
  25. exit
  26. fi