uninstall.sh 641 B

12345678910111213141516171819202122232425262728293031323334353637
  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. # Make sure the input is y or n
  14. until [ "y" == ${flag} ] || [ "n" == ${flag} ]
  15. do
  16. echo "Please input y/n again"
  17. read flag
  18. done
  19. case $flag in
  20. "y")
  21. rm -rf $served/$conf
  22. echo "The service has uninstalled"
  23. ;;
  24. "n")
  25. echo "Exit"
  26. exit 0
  27. ;;
  28. *)
  29. echo "Error,exit uninstall"
  30. ;;
  31. esac