zabbix添加开机自启
原文链接:https://www.cnblogs.com/zydev/p/6888805.html
1. zabbix客户端的系统服务脚本
1.1 拷贝启动脚本
zabbix的源码提供了系统服务脚本,在/usr/local/src/zabbix-3.2.6/misc/init.d目录下,我的系统是CentOS的,所以选择fedora下的脚本复制到/etc/init.d下
|
1
2
3
4
|
[root@lanmp core5]# pwd/usr/local/src/zabbix-3.2.6/misc/init.d/fedora/core5[root@lanmp core5]# cp -a zabbix_agentd /etc/init.d/ |
这里需要添加一个软链接,否则会报错退出
|
1
|
ln -s /usr/local/zabbix-3.2.6/sbin/zabbix_agentd /usr/local/sbin/ |
1.2 添加到开机自启动
|
1
2
3
4
|
[root@lanmp init.d]# chkconfig --add zabbix_agentd[root@lanmp init.d]# chkconfig zabbix_agentd on[root@lanmp init.d]# chkconfig --list|grep zabbix_agentdzabbix_agentd 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
脚本内容
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/bin/bash## /etc/rc.d/init.d/zabbix_agentd## Starts the zabbix_agentd daemon## chkconfig: - 95 5# description: Zabbix Monitoring Agent# processname: zabbix_agentd# pidfile: /tmp/zabbix_agentd.pid# Modified for Zabbix 2.0.0# May 2012, Zabbix SIA# Source function library.. /etc/init.d/functionsRETVAL=0prog="Zabbix Agent"ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"if [ ! -x ${ZABBIX_BIN} ] ; then echo -n "${ZABBIX_BIN} not installed! " # Tell the user this has skipped exit 5fistart() { echo -n $"Starting $prog: " daemon $ZABBIX_BIN RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_agentd echo}stop() { echo -n $"Stopping $prog: " killproc $ZABBIX_BIN RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix_agentd echo}case "$1" in start) start ;; stop) stop ;; reload|restart) stop sleep 10 start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/zabbix_agentd ]; then stop start fi ;; status) status $ZABBIX_BIN RETVAL=$? ;; *) echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}" exit 1esacexit $RETVAL |
2.2 服务端的系统服务脚本
同样的方法,这里就不演示了
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/bin/bash## /etc/rc.d/init.d/zabbix_server## Starts the zabbix_server daemon## chkconfig: - 95 5# description: Zabbix Monitoring Server# processname: zabbix_server# pidfile: /tmp/zabbix_server.pid# Modified for Zabbix 2.0.0# May 2012, Zabbix SIA# Source function library.. /etc/init.d/functionsRETVAL=0prog="Zabbix Server"ZABBIX_BIN="/usr/local/sbin/zabbix_server"if [ ! -x ${ZABBIX_BIN} ] ; then echo -n "${ZABBIX_BIN} not installed! " # Tell the user this has skipped exit 5fistart() { echo -n $"Starting $prog: " daemon $ZABBIX_BIN RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_server echo}stop() { echo -n $"Stopping $prog: " killproc $ZABBIX_BIN RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix_server echo}case "$1" in start) start ;; stop) stop ;; reload|restart) stop sleep 10 start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/zabbix_server ]; then stop start fi ;; status) status $ZABBIX_BIN RETVAL=$? ;; *) echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}" exit 1esacexit $RETVAL |
zabbix添加开机自启的更多相关文章
- Redis单机部署、添加开机自启、配置参数
1.Redis简介 redis是使用C语言编写的开源的,支持网络,基于内存,可持久性的键值对存储数据库,2013年5月之前,Redis是最流行的键值对存储数据库,Redis采用内存数据集,支持多种数据 ...
- Centos 7 redis、tomcat、Spring Boot添加开机自启服务
一.redis添加开机自启 1.添加服务配置文件 [root@test system]# vim /etc/systemd/system/redis-server.service 2.服务配置文件内容 ...
- kali添加开机自启[亲测有效]
kali添加开机自启 采用systemd的方法,kali默认是没有rc.local的,需要自己创建.本方法也适用于ubuntu 18.04 64bit 改写rc-local.service 文件 先从 ...
- ubuntu添加开机自启和sysv-rc-conf
此文ubuntu使用sysvinit,而非upstart UBUNTU添加开机自动启动程序方法 1. 开机启动时自动运行程序 Linux加载后, 它将初始化硬件和设备驱动, 然后运行第一个进程i ...
- linux中添加开机自启服务的方法
往文件/etc/rc.d/rc.local中追加内容即可,如: /mongodb/start_mongoDB.sh
- 【centos7】添加开机启动服务/脚本
一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...
- centos7如何添加开机启动服务/脚本
一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...
- Centos 下添加开机自启动服务和脚本
最近刚玩Centos7的系统,跟Centos6还是很多方面有改变的,这里记录一下怎么在Centos7下添加开机自启动脚本和服务的方法. 1.添加开机自启服务 我这里以docker 服务为例,设置如下两 ...
- Centos7下shell脚本添加开机自启动
添加开机自启脚本,注意都需要用绝对路径 psubscribe.sh脚本中的内容: nohup /usr/bin/php -f /data/aliyun51015cn/redisChannel/psub ...
随机推荐
- java——ArrayList中contains()方法中的疑问
问题引子: ist<Student> students=new ArrayList<Student>(); students.add(new Student("201 ...
- 文件名后面加(1).text
; //在重复名称后加(序号) while (File.Exists(path)) { if (path.Contains(").")) { int start = path.La ...
- 解决windows系统下ping,ipconfig不是内部或外部命令
一般情况下,都是误删了系统变量path的值.解决方法:右击我的电脑 → 选择属性 → 选择高级系统设置 → 环境变量 → 在系统变量列表中,找到“path”环境变量双击,打开.在变量值这一栏检测下是否 ...
- Java学习笔记【九、集合框架】
集合框架设计的目标: 高性能. 允许不同类型的集合,以类似的方式工作,有互操作性. 对一个集合的扩展和适应必须简单. 集合框架包含: 接口:代表集合的抽象数据类型. 实现(类):具体实现(ArrayL ...
- Bridge的数据在内核处理流程
转:http://blog.sina.com.cn/s/blog_67cc0c8f0101oh33.html 转载一篇Bridge的数据在内核处理流程,文章写的不错啊! (2013-07-05 16: ...
- vue+elementui搭建后台管理界面
1 会话存储 使用html5的 sessionStorage 对象临时保存会话 // 保存会话 sessionStorage.setItem('user', username) // 删除会话 ses ...
- vmware 兼容问题
1.出现此问题的原因是Device Guard或Credential Guard与Workstation不兼容.2.Windows系统的Hyper-V不兼容导致.解决方法: 步骤一:禁用Device ...
- 复习rem
在Web页面制作中,我们一般使用“px”来设置我们的文本,因为他比较稳定和精确.但是这种方法存在一个问题,当用户在浏览器中浏览我们制作的Web页面时,他改变了浏览器的字体大小(虽然一般人不会去改变浏览 ...
- 第十五届四川省省赛 SCU - 4439 Vertex Cover
给你一个一般图 保证每条边的一端下标不大于30 问最小覆盖集的大小为多少 爆搜:枚举前30个点是否在覆盖集内 剪枝1:如果不在的话 那么他所连的下标大于30的点都必须选 剪纸2:最优解剪枝 #incl ...
- pgsql 相关函数
1.COALESCE — 空值替换函数.示例:COALESCE(col, 'replacement') :如果col列的值为null,则col的值将被替换为'replacement' 2.regexp ...