uninstall.sh 515 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. set -e
  3. show_usage() {
  4. printf "./uninstall.sh -n process\n\
  5. -n|--name%-8sprocess name\n\
  6. -h|--help%-8sfor help\n"
  7. }
  8. server_name=""
  9. while [ -n "$1" ]; do
  10. case "$1" in
  11. -n|--name ) server_name=$1 ; shift 1;;
  12. -h|--help ) echo show_usage ; exit 0;;
  13. * ) echo show_usage; exit 1 ;;
  14. esac
  15. done
  16. if [[] "" == $server_name ]];then
  17. echo "Invalid server"
  18. exit 1
  19. fi
  20. echo "Uninstalling server $server_name"
  21. rm -f /etc/init.d/$server_name
  22. echo "Uninstall server $server_name successfully!!!"