Einfaches Tool um verschiedene Tasks in handlicher Form anbieten zu können
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.

51 lines
1.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #!/usr/bin/env bash
  2. #
  3. # Einfaches Start/Stopp/Restart Script
  4. # (C) 2021 by bithost GbR
  5. #
  6. ### START CONFIG ###
  7. INSTANCE_NAME='DemoProject'
  8. START_CMD='/home/demo/runscript.sh'
  9. ### END CONFIG - DO NOT EDIT BELOW THIS MESSAGE!!! ###
  10. PS3='Was möchtest du machen? '
  11. options=("Server starten" "Server stoppen" "Server neustarten" "Abbruch")
  12. select opt in "${options[@]}"
  13. do
  14. case $opt in
  15. "Server starten")
  16. echo "Server wird gestartet..."
  17. tmux new-session -d -s $INSTANCE_NAME $START_CMD
  18. break
  19. ;;
  20. "Server stoppen")
  21. echo "Server wird gestoppt"
  22. tmux send-keys -t $INSTANCE_NAME.0 'quit' ENTER
  23. break
  24. ;;
  25. "Server neustarten")
  26. echo "Server wird neugestartet"
  27. tmux send-keys -t $INSTANCE_NAME.0 say' Automatischer Neustart in 180 Sekunden!' ENTER
  28. sleep 120
  29. tmux send-keys -t $INSTANCE_NAME.0 say' Automatischer Neustart in 60 Sekunden!' ENTER
  30. sleep 40
  31. tmux send-keys -t $INSTANCE_NAME.0 say' Automatischer Neustart in 30 Sekunden!' ENTER
  32. sleep 20
  33. COUNT=10
  34. while [ $COUNT -gt 0 ]; do
  35. tmux send-keys -t $INSTANCE_NAME.0 say' Automatischer Neustart in ' $COUNT ' Sekunden!' ENTER
  36. let COUNT=COUNT-1
  37. sleep 1
  38. done
  39. tmux send-keys -t $INSTANCE_NAME.0 'quit' ENTER
  40. tmux new-session -d -s $INSTANCE_NAME $START_CMD
  41. break
  42. ;;
  43. "Abbruch")
  44. break
  45. ;;
  46. *) echo "Unbekannte Eingabe: $REPLY";;
  47. esac
  48. done