25 Star 127 Fork 32

anolis/keentuned

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
keentuned_install.sh 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
liuwenchao 提交于 2023-07-27 14:57 . feat: update to version 2.2.0
# Copyright (c) 2021-2023 Alibaba Cloud Computing Ltd.
# SPDX-License-Identifier: MulanPSL-2.0
#!/bin/bash
# keentuned configuration and installation script
# code_home 代码仓的位置, 写到daemon这一级
code_home=`pwd`
# keentuned_home keentune依赖的配置文件位置
keentuned_home="/etc/keentune/keentuned"
Check_Exec() {
if [ $? -ne 0 ]; then
echo -e "exec [$1] failed";
exit 1
fi
}
# 1. Copy keentuned Configuration
if [ ! -d "$code_home" ]; then
echo "code_home must be specified"
exit 1
else
echo "code_home is ${code_home}, begin to Compile keentune"
fi
if [ ! -d /etc/keentune/keentuned/conf ]; then
mkdir -p /etc/keentune/keentuned/conf
Check_Exec "mkdir /etc/keentune/keentuned/conf"
fi
cp $code_home/keentuned.conf -f $keentuned_home/conf
Check_Exec "cp keentuned.conf"
/bin/cp -rf $code_home/daemon/examples/. $keentuned_home
if [ $? -ne 0 ]; then
cp -rf $code_home/daemon/examples/. $keentuned_home
Check_Exec "cp -rf examples to keentune home"
fi
#2. set go env
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
echo "Step1. Complete environment configuration"
#3. go install
cd $code_home/daemon
go install .
Check_Exec "install keentune service"
go install ../cli
Check_Exec "install keentune cli"
go_path=`go env | grep -i "GOPATH" | awk -F'"' '{print$2}'`
if [ -f ${go_path}/bin/daemon ]; then
mv ${go_path}/bin/daemon -f /usr/bin/keentuned
echo "Step2. Build 'keentuned' daemon successfully"
else
echo "daemon not exist"
exit 1
fi
if [ -f ${go_path}/bin/cli ]; then
mv ${go_path}/bin/cli -f /usr/bin/keentune
echo "Step3. Build 'keentune' command successfully"
else
echo "cli not exist"
exit 1
fi
echo "Step4. Welcome to use!"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/anolis/keentuned.git
git@gitee.com:anolis/keentuned.git
anolis
keentuned
keentuned
master

搜索帮助

Cb406eda 1850385 E526c682 1850385