This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-olp-exporter/src/main/resources/build/install.sh
fangshunjian b45142da9c feat: 新增打包脚本
打包方式:
1、mvn clean package
2、将编译好的 jar 删除.jar 文件后缀后 和 build 中文件 放到同一目录
3、使用tar 命令打包,tar -zcvf olp_exporter.tar.gz ./*

安装:
1、执行 install.sh ,安装成功后会自动启动运行,并设置开机启动
2021-08-31 16:15:23 +08:00

27 lines
579 B
Bash

#!/bin/bash
CUR_PATH=`pwd`
echo "install path: $CUR_PATH"
echo "install olp_exporter as a systemd service"
chmod +x $CUR_PATH/olp_exporter
cat > /etc/systemd/system/olp_exporter.service <<EOF
[Unit]
Description=olp_exporter
After=syslog.target
[Service]
ExecStart=$CUR_PATH/olp_exporter
SuccessExitStatus=143
RestartSec=10s
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
echo "systemctl start olp_exporter.service"
systemctl start olp_exporter.service
echo "Set the power-on start-up"
systemctl enable olp_exporter.service
echo "install done"