一、添加开机启动脚本
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
#添加开机启动inotify.sh脚本
/root/inotify.sh
方法一
注意、服务也可以使用下面方法设置开机启动,如追加rc.local文件追加/usr/bin/rsync --daemon就是开启启动rsync服务
1、首先,脚本具有可执行权限
chmod 755 inotify.sh
2、然后将脚本存放的绝对路径+脚本全名追加到/etc/rc.d/rc.local文件最后
/root/inotify.sh
3、在centos7中,/etc/rc.d/rc.local的权限被降低了,所以需要执行如下命令赋予其可执行权限
chmod +x /etc/rc.d/rc.local
方法二
1、将脚本移动到/etc/rc.d/init.d目录下
mv /opt/script/inotify.sh /etc/rc.d/init.d
2、增加脚本的可执行权限
chmod +x /etc/rc.d/init.d/inotify.sh
3、添加脚本到开机自动启动项目中
cd /etc/rc.d/init.d
chkconfig --add inotify.sh
chkconfig inotify.sh
注意!
你直接把你的平时写的加的脚本这样chkconfig --add 肯定是要报service inotify.sh does not support chkconfig 错误的,不过你只需要在#!/bin/bash下面加上如下内容就行。
#chkconfig: 345 88 14
【centos7】添加开机启动服务/脚本
一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...
centos7如何添加开机启动服务/脚本
一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...
(转) CentOS 7添加开机启动服务/脚本
CentOS 7添加开机启动服务/脚本 原文:http://blog.csdn.net/wang123459/article/details/79063703 一.添加开机自启服务 在CentOS 7 ...
CentOS7添加开机启动服务/脚本(延用CentOS6方法)
一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...
CentOS 7添加开机启动服务/脚本
一.添加开机自启服务 在CentOS 7中添加开机自启服务非常方便,只需要两条命令(以 jenkins 为例):systemctl enable jenkins.service #设置jenkins服 ...
CentOS 7添加开机启动服务脚本
一.添加开机自启服务 在CentOS 7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务 ...
Linux—添加开机启动(服务/脚本)
系统启动时需要加载的配置文件 /etc/profile./root/.bash_profile/etc/bashrc./root/.bashrc/etc/profile.d/*.sh./etc/pro ...
Centos7 下添加开机自启动服务和脚本
1.添加开机自启服务 #设置jenkins服务为自启动服务 systemctl enable jenkins.service #启动jenkins服务 systemctl start jenkins. ...
centos7如何添加开机启动项?
centos7提供开启服务启动的方式: 1.系统服务管理命令,如果是通过yum安装的软件,开机启动脚本,已经自动创建好了,直接执行如下命令 nginx.service后缀可以省略 systemctl ...
随机推荐
整合Spring、SpringMVC、MyBatis
spring+springmvc+mybatis集成 一个核心:将对象交给spring管理. 1新建web项目 2添加项目jar包 spring包见上一篇博客 3建立项目的目录结构 4完成Mapper ...
Oracle的日期时间范围查询
Oracle日期时间范围查询 Sql代码 /* 日期时间范围查询 */ ---------- 创建日期时间测试表-------------------------------------------- ...
Android 控件 -------- AutoCompleteTextView 动态匹配内容,例如 百度搜索提示下拉列表功能
AutoCompleteTextView 支持基本的自动完成功能,适用在各种搜索功能中,并且可以根据自己的需求设置他的默认显示数据.两个控件都可以很灵活的预置匹配的那些数据,并且可以设置输入多少值时开 ...
js 几个特殊情况
alert(033-15);//12,前缀0用在直接量中,表示八进制 alert('033'-15);//18,前缀0用在字符串中,在(隐式)转换将忽略 alert(parseInt('033')-1 ...
wiki 3143 二叉树的前序、中序及后序遍历
先序遍历:訪问根.遍历左子树.遍历右子树,简称:DLR. 中序遍历:遍历左子树,訪问根,遍历右子树,简称:LDR. 后序遍历:遍历左子树,遍历右子树.訪问根.简称:LRD. 数组搞的: #pragma ...
给RelativeLayout设置背景,无效果bug解决
drawable文件夹下面 tomyshop_selector.xml文件 <?xml version="1.0" encoding="utf-8"?&g ...
python 分支语句 循环语句
分支语句 #if-else if a > b: print('aaa') else: print('bbb') #if-elif-else if a > b: print('a>b' ...
webpack打包nodejs项目(前端代码)
PS.若本文没有帮到你可以看看我的进阶版点此前往 适用情况 首先说明,此情况不具备普遍性.若你的情况与笔者类似那么希望这篇文章能够帮到你. 我的项目情况是这样的:用node.js做后台,ejs做模板引 ...
简单使用zabbix监控nginx是否存活
1.在agent端修改主配置文件 vim /etc/zabbix/zabbix_agentd.conf ........ ........ UserParameter=nginx.status[*], ...
Spring 依赖注入方式详解(四)
IoC 简介 平常的Java开发中,程序员在某个类中需要依赖其它类的方法. 通常是new一个依赖类再调用类实例的方法,这种开发存在的问题是new的类实例不好统一管理. Spring提出了依赖注入的思想 ...