WGCLOUD在linux设置agent随机启动说明
2021-07-22 本文已影响0人
王逅逅_f6c0
我自己是在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
- 其他说明
# 关闭开机启动
[root@localhost ~]# chkconfig startAgent.sh off
# 从chkconfig管理中删除startAgent.sh
[root@localhost ~]# chkconfig --del startAgent.sh
# 查看chkconfig管理
[root@localhost ~]# chkconfig --list startAgent.sh