centos添加自定义程序到service
来源:互联网 发布:无锡丝密斯 知乎 编辑:程序博客网 时间:2024/05/17 08:34
这里以zabbix_agentd 为例,其他程序可通用,请自行选择:
在/etc/init.d新建zabbix_agentd启动文件
vim /etc/init.d/zabbix_agentd
#!/bin/sh
# chkconfig: 2345 10 90# description: zabbix_agentd
# Zabbix
# Copyright (C) 2001-2015 Zabbix SIA
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Start/Stop the Zabbix agent daemon.
# Place a startup script in /sbin/init.d, and link to it from /sbin/rc[023].d
SERVICE="Zabbix agent"
DAEMON=/usr/local/zabbix/sbin/zabbix_agentd //zabbix原启动文件路径
PIDFILE=/usr/local/zabbix/log/zabbix_agentd.pid //pid文件路径
case $1 in
'start')
if [ -x ${DAEMON} ]
then
$DAEMON
# Error checking here would be good... else
echo "Can't find file ${DAEMON}."
echo "${SERVICE} NOT started."
fi
;;
'stop')
if [ -s ${PIDFILE} ]
then
if kill `cat ${PIDFILE}` >/dev/null 2>&1
then
echo "${SERVICE} terminated."
rm -f ${PIDFILE}
fi
fi
;;
'restart')
$0 stop
sleep 10
$0 start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
esac
echo "${SERVICE} started."
保存并退出,给予执行权限
chmod +x /etc/init.d/zabbix_agentd
0 0
- centos添加自定义程序到service
- Fedora 16 添加自定义程序到Favorites
- Openstack组件部署 — 将一个自定义 Service 添加到 Keystone
- centos下为redis添加service
- CentOS 添加用户到sudoers
- 添加程序到Nuttx
- CentOS下添加程序到服务并且设置服务自动启动的方法
- CentOS下添加程序到服务并且设置服务自动启动
- 将svn-service添加到windows服务
- spring boot 应用添加到linux service
- Linux 添加Nginx 到 service 启动
- Linux 添加Nginx 到 service 启动
- CentOS 7 systemd添加自定义系统服务
- CentOS 7 systemd添加自定义系统服务
- CentOS 7 systemd添加自定义系统服务
- CentOS 7 systemd添加自定义系统服务
- windows service程序定时器的添加
- 如何添加 GNOME 到 CentOS Minimal
- 文章标题
- Matlab GUI通用函数get和set
- Aoj 0033 Ball【dfs枚举】
- c++STL(一)重载与模板。
- 100.View the Exhibit and examine the structure of the PROMOTIONS table.
- centos添加自定义程序到service
- Javase02标识符,关键字和基本数据类型
- js 时间格式
- Android EditText setOnClickListener事件 只有获取焦点才能响应 采用setOnTouchListener解决
- 【MySQL新手必看】百宝云的MySQL数据库基础知识
- 算法1:1020. Big Integer
- gerrit reindex
- Lua中的面向对象[2]:使用指针
- leetcode 每日一题 100. Same Tree