Linux添加gokins服务

/opt/gokins/start.sh

!/bin/bash



start(){
  #podman start $(podman ps -a | grep -wv Up  | awk 'FNR!=1 {print($1)}')
  #cd /opt/gokins && nohup /opt/gokins/gokins-sqlite_linux_amd64 > /tmp/gokins.log 2>&1 &
  nohup /opt/gokins/gokins-sqlite_linux_amd64 > /tmp/gokins.log 2>&1 &
}

stop(){
  #podman stop $(podman ps -a | grep Up  | awk 'FNR!=1 {print($1)}')
  kill -9 `ps -ef | grep /opt/gokins | awk '{print($2)}' | awk 'NR==1'`
}

restart(){
  stop
  echo 'Gokins stoped!'
  start
  echo 'Gokins started!'
}

case $1 in
  start)  
    start   
    ;;
  stop)
    stop    
    ;;
  restart)
    restart 
    ;;
  *)
    start   
esac


####

ps -f | grep /opt/gokins
ps -f | grep /opt/gokins | awk '{print($0)}'

kill -9 `ps -f | grep /opt/gokins | awk '{print($2)}' | awk 'NR==1'`

项目配置

KuaiYu-Management-Web

  1. 变量

    名称
    time date "+%Y%m%d%H%M%S"
    LAST_COMMIT_ID git rev-parse --short HEAD
    NAS_HOST 192.168.3.99
    NAS_PATH /volume1/701项目组/006.研发补丁/ky_opsp[管理客户端]/
    NAS_USER sparon
    DEPLOY_HOST 192.168.6.221
    DEPLOY_PATH /data/kuaiyu/ky_opsp
    DEPLOY_USER root
    DEPLOY_PASS 112223
  2. 设置

    • 账号:sparon

    • Access Token: a9ea2d814e789e95760d87e7c15d4cc38fcd97ec

    • 仓库地址:http://git.kuaiyuai.top/KuaiYu-ZKer/KuaiYu-Management-Web

    • 流水线配置:

      version: 1.0
      vars:
      stages:
        - stage:
          displayName: build
          name: build
          steps:
            - step: shell@sh
              displayName: build-yarn
              name: build-yarn
              env:
              commands:
                - yarn && yarn build
                #- time=`date "+%Y%m%d%H%M%S"`
                #- tar -czf ky_opsp-${time} ./dist/** && cp ky_opsp-$time.tar /root/
                - tar zcf ky_opsp.tar -C dist .
                #- tar -czf ky_opsp-${{LAST_COMMIT_ID}}.tar ./dist/** && cp ky_opsp-${{LAST_COMMIT_ID}}.tar /root/
                #- scp ky_opsp.tar ${{NAS_USER}}@${{NAS_HOST}}:${{NAS_PATH}}/ky_opsp-`date "+%Y%m%d%H%M%S"`.tar
                - scp ky_opsp.tar ${{DEPLOY_USER}}@${{DEPLOY_HOST}}:${{DEPLOY_PATH}}/web.tar
              #artifacts:
              #  - scope: repo
              #    repository: olu1fgjx
              #    name: KY_OPSP
              #    path: ./ky_opsp.tar
            - step: shell@ssh
              displayName: deploy-web
              name: deploy-web
              wait: [build-yarn]
              input:
                host: ${{DEPLOY_HOST}}:22
                user: ${{DEPLOY_USER}}
                pass: ${{DEPLOY_PASS}}
                workspace: ${{DEPLOY_PATH}}
              commands:
                - pwd && ls
                - rm -rf web/**
                - tar zxf web.tar  -C web && rm -rf web.tar && ls
                - cd .. && pwd
                - pwd && ls
                - /data/kuaiyu/20.intercom.sh 4 3
      
  3. 触发器

    • 类型:webHook / gitea
    • 密钥:e030f2d1-1112-4ce1-a581-fcfac9affc8c
    • 分支:master

KuaiYu-Talk-Web

  1. 变量

    名称
    time date "+%Y%m%d%H%M%S"
    LAST_COMMIT_ID git rev-parse --short HEAD
    NAS_HOST 192.168.3.99
    NAS_PATH /volume1/产品中心-平台软件组\006.YF研发补丁/研发补丁上传/管教谈话转写系统(V7)/前端/
    NAS_USER sparon
    DEPLOY_HOST 192.168.6.222
    DEPLOY_PATH /kuaiyu/ky-talk-web
    DEPLOY_USER root
    DEPLOY_PASS 112223
  2. 设置

    • 账号:sparon

    • Access Token: a9ea2d814e789e95760d87e7c15d4cc38fcd97ec

    • 仓库地址:http://git.kuaiyuai.top/KuaiYu-ZKer/KuaiYu-Talk-Web

    • 流水线配置:

      version: 1.0
      vars:
      stages:
        - stage:
          displayName: build
          name: build
          steps:
            - step: shell@sh
              displayName: build-yarn
              name: build-yarn
              env:
              commands:
                - yarn && yarn build
            - step: shell@sh
              displayName: build-tar
              name: build-tar
              wait: [build-yarn]
              commands:
                - pwd && ls
                - tar zcf ky_talk.tar -C dist .
                - scp ky_talk.tar ${{NAS_USER}}@${{NAS_HOST}}:${{NAS_PATH}}/ky_talk-`date "+%Y%m%d%H%M%S"`.tar
                #- scp ky_talk.tar ${{DEPLOY_USER}}@${{DEPLOY_HOST}}:${{DEPLOY_PATH}}/web.tar
              #artifacts:
              #  - scope: repo
              #    repository: olu1fgjx
              #    name: KY_TALK_WEB
              #    path: ./ky_talk.tar
      
  3. 触发器

    • 类型:webHook / gitea
    • 密钥:72cf19ba-5524-4ba7-9b85-35ce088a920e
    • 分支:develop

KuaiYu-Inspection-Voice

  1. 变量

    名称
    time date "+%Y%m%d%H%M%S"
    LAST_COMMIT_ID git rev-parse --short HEAD
    NAS_HOST 192.168.3.99
    NAS_PATH /volume1/产品中心-平台软件组\006.YF研发补丁/
    NAS_USER sparon
    DEPLOY_HOST 192.168.6.222
    DEPLOY_PATH /kuaiyu/ky-inspect-web
    DEPLOY_USER root
    DEPLOY_PASS 112223
  2. 设置

    • 账号:sparon

    • Access Token: a9ea2d814e789e95760d87e7c15d4cc38fcd97ec

    • 仓库地址:http://git.kuaiyuai.top/KuaiYu-ZKer/KuaiYu-Inspection-Voice

    • 流水线配置:

      version: 1.0
      vars:
      stages:
        - stage:
          displayName: build
          name: build
          steps:
            - step: shell@sh
              displayName: build-yarn
              name: build-yarn
              env:
              commands:
                - yarn && yarn build
                - pwd && ls
                - tar zcf ky_inspect_web.tar -C dist .
                #- scp ky_talk.tar ${{NAS_USER}}@${{NAS_HOST}}:${{NAS_PATH}}/ky_talk-`date "+%Y%m%d%H%M%S"`.tar
                - scp ky_talk.tar ${{DEPLOY_USER}}@${{DEPLOY_HOST}}:${{DEPLOY_PATH}}/web.tar
              #artifacts:
              #  - scope: repo
              #    repository: olu1fgjx
              #    name: KY_TALK_WEB
              #    path: ./ky_talk.tar
            - step: shell@ssh
              displayName: deploy-web
              name: deploy-web
              wait: [build-yarn]
              input:
                host: ${{DEPLOY_HOST}}:22
                user: ${{DEPLOY_USER}}
                pass: ${{DEPLOY_PASS}}
                workspace: ${{DEPLOY_PATH}}
              commands:
                - pwd && ls
                - rm -rf web/**
                - tar zxf web.tar  -C web && rm -rf web.tar && ls
                - cd .. && pwd
                - pwd && ls
                - /kuaiyu/11.talk-vpr.sh 6 3
      
  3. 触发器

    • 类型:webHook / gitea
    • 密钥:7BA0C4E5-940A-44F6-AF4E-FC6354A37E25
    • 分支:master