智能
助手
最大化  清空记录 停止  历史记录
翻译选中文本
选中一段文本后进行翻译
名词解释
选中一段文本后进行名词解释
知识图谱生成
通过图谱展示知识信息
登录用户在知识浏览页面可用
答案生成
AI自动回答一个问答功能中的问题
登录用户在问答浏览页面,且问题开放回答中可用
知识摘要
自动为当前知识生成摘要
知识浏览页面可用
知识问答
针对当前知识进行智能问答
知识浏览面可用
   1168  
查询码: 00000006
一键卸载及相关目录删除脚本,可选卸载或保留程序
作者: wyasw 于 2020年03月29日 发布在分类 / Linux / 常用shell脚本 ,于 2020年03月29日 编辑
shell

需求:一键卸载程序及相关目录删除,可选卸载或保留程序

#!/usr/bin/env bash

##uninstall

##stop bcchain

function StopBcchain(){

if $(systemctl -q is-active bcchain.service) ; then

  systemctl stop bcchain.service

fi

uid=$(id -u bcchain 2>/dev/null)

if [[ "${uid:-}" != "0" ]];then

  pid=$(ps -fubcchain 2>/dev/null|grep 'bcchain'|awk '$0 !~/grep/ {print $2}'|sed -e 's/\n/ /')

  if [[ "${pid:-}" != "" ]]; then

      echo "kill old process. ${pid}"

      kill -9 ${pid}

  fi

fi

}

###

echo ""

echo "Do you want to uninstall & remove all of this bcb node?"

options=("yes" "no")

select opt in "${options[@]}" ; do

case ${opt} in

  "yes")

    echo ""

    echo "Yes, uninstall & remove all of this bcb node"    

    StopBcchain

    systemctl disable bcchain.service

    rm -fr /etc/bcchain

    rm -fr /home/bcchain

    echo "The deleted directories are /etc/bcchain,/home/bcchain."

    echo ""

    break

    ;;

  "no")

    echo ""

    echo "No, keep the old bcb node"

    echo ""

    exit 1

    break

    ;;

  *) echo "Invalid choice.";;

  esac

done

笔记
0人参与


 历史版本

备注 修改日期 修改人
创建版本 2020-03-29 21:03:16[当前版本] wyasw

文艺知识分享平台 -V 5.2.5 -wcp