美文网首页wgcloud运维监控工具
WGCLOUD在linux设置agent随机启动说明

WGCLOUD在linux设置agent随机启动说明

作者: 王逅逅_f6c0 | 来源:发表于2021-07-22 12:37 被阅读0次

我自己是在centos8下测试成功的,如下

1.在/etc/rc.d/init.d新建启动脚本startAgent.sh,内容如下

#!/bin/sh
#chkconfig: 35 20 80               分别代表运行级别,启动优先权,关闭优先权,此行代码必须
#description: wgcloud agent
/bin/echo $(/bin/date +%F_%T) >> /tmp/agent.log
/usr/local/wgcloud-v3.3.3/agent/start.sh

/usr/local/wgcloud-v3.3.3/agent/start.sh为自己的agent实际路径

2.添加可执行权限

chmod +x startAgent.sh

测试下脚本是否能成功启动agent

./startAgent.sh
3.添加脚本到开机自动启动项目中。添加到chkconfig,开机自启动

[root@localhost ~]# cd /etc/rc.d/init.d
[root@localhost ~]# chkconfig --add startAgent.sh
[root@localhost ~]# chkconfig startAgent.sh on

  1. 其他说明
# 关闭开机启动 
[root@localhost ~]# chkconfig startAgent.sh off
 
# 从chkconfig管理中删除startAgent.sh
[root@localhost ~]# chkconfig --del startAgent.sh
 
# 查看chkconfig管理
[root@localhost ~]# chkconfig --list startAgent.sh

相关文章

网友评论

    本文标题:WGCLOUD在linux设置agent随机启动说明

    本文链接:https://www.haomeiwen.com/subject/ulbemltx.html