centos7之添加开机启动服务/脚本
一、添加开机启动脚本
#!/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】添加开机启动服务/脚本
一.添加开机自启服务 在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 ...
随机推荐
- Maven(九)Eclipse创建Web项目(简单方式)
1. 创建Maven项目(以简单方式) 2. 勾选WAR 3. 选择properties->projectFacts 此处的错误可忽略,配置好会会消失,主要缺失web.xml文件 4. 将框中选 ...
- springboot 使用 redis
springboot 自己是实现了一套 redis 缓存框架, 地址: https://www.cnblogs.com/huanggy/p/9473822.html, 通过配置即可轻松愉快地实现 某些 ...
- 【阿里云】在 Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务
Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务 一.安装 Filezilla Server 下载最新版本的 Filezilla Server ...
- C#:在匿名方法中捕获外部变量
先来一段代码引入主题.如果你可以直接说出代码的输出结果,说明本文不适合你.(代码引自<深入理解C#>第三版) class Program { private delegate void T ...
- 算法:数组中和为s的两个数字
@问题 :题目描述输入一个递增排序的数组和一个数字S,在数组中查找两个数,使得他们如果有多对数字的和等于S,输出两个数的乘积最小的. 输出描述:对应每个测试案例,输出两个数,小的先输出.@思路: 两个 ...
- 总结XSS与CSRF两种跨站攻击
XSS:跨站脚本(Cross-site scripting),实际应是"CSS",但由于和层叠样式表CSS名称冲突,故改为"XSS" CSRF:跨站请求伪造(C ...
- Linux & Windows 环境下 RabbitMQ 安装与基本配置
索引: 目录索引 参看代码 GitHub: rabbitmq.txt 一.Linux (DeepinOS) 环境 .安装: sudo apt install rabbitmq-server .进入目录 ...
- TDBGridEh 标头排序
数据源为adoQuery 1.首先设置dbGridEh里需要排序的字段的Title->Titlebutton属性为true 2.设置dgGridEh的optionsEh->dbhautoS ...
- 使用Python的列表推导式计算笛卡儿积
笛卡儿积: 笛卡儿积是一个列表, 列表里的元素是由输入的可迭代类型的元素对构 成的元组,因此笛卡儿积列表的长度等于输入变量的长度的乘积, 如下图: 如果你需要一个列表,列表里是 3 种不同尺寸的 T ...
- linux文件行首行尾添加或替换
sed -i 's/\(^.*\)/http:\/\/www.blutmagie.de\/img\/flags\//g' cc.txt sed -i 's/\($\)/.gif/g' cc.txt