uninstall.sh 608 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. #Read service name you want to uninstall
  3. echo "Please input the service you want to uninstall"
  4. read conf
  5. served="/etc/supervisord.d"
  6. if [ ! -f "$served/$conf" ]
  7. then
  8. echo "The service is not existing"
  9. exit 1
  10. fi
  11. echo "Are you sure uninstall ${conf}? y/n"
  12. read flag
  13. until [ "y" == ${flag} ] || [ "n" == ${flag} ]
  14. do
  15. echo "Please input y/n again"
  16. read flag
  17. done
  18. case $flag in
  19. "y")
  20. rm -rf $served/$conf
  21. echo "The service has uninstalled"
  22. ;;
  23. "n")
  24. echo "Exit"
  25. exit 0
  26. ;;
  27. *)
  28. echo "Error,exit uninstall"
  29. ;;
  30. esac