Linux部署的WGCLOUD监控系统的server和agent都可以设置开机自启动
就像普通的应用一样,用通用的Linux设置开机启动就可以
服务端server和被控端agent的设置方式一样,以下是设置agent的开机启动方式
server开机启动方式可以看这里,https://www.wgstart.com/help/docs38.html
1、以Ubuntu 20为例,新建/etc/systemd/system/wgcloudAgent.service文件,
[root@localhost~]# vim /etc/systemd/system/wgcloudAgent.service
内容如下,将下列内容复制进/etc/systemd/system/wgcloudAgent.service文件
[Unit] Description=auto Start Wgcloud Agent After=network.target syslog.target [Service] Type=forking ExecStart=/etc/wgcloudAgent.local [Install] WantedBy=multi-user.target
2、创建文件/etc/wgcloudAgent.local
[root@localhost~]# vim /etc/wgcloudAgent.local
内容如下
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /usr/local/wgcloud-v3.3.5/agent/start.sh exit 0
注意:/usr/local/wgcloud-v3.3.5/agent/start.sh改为自己的agent实际部署路径
3、给/etc/wgcloudAgent.local加可执行权限
[root@localhost~]# chmod +x /etc/wgcloudAgent.local
4、最后两步,重新载入systemd服务和设置开机自启动,完成
[root@localhost~]# systemctl daemon-reload [root@localhost~]# systemctl enable wgcloudAgent
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70024568/viewspace-2937981/ ,如需转载,请注明出处,否则将追究法律责任。