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 ...
随机推荐
- Java 由浅入深GUI编程实战练习(二)
一,项目简介 1.利用Java GUI 绘制图像界面,设置整体布局 2.编写一个随机数生成1~100的随机数 3.编写一个验证类,用于验证用户输入值与生成随机数是否相等并记录用户猜测次数,当用户猜测成 ...
- JavaScript是如何工作的:深入类和继承内部原理 + Babel和TypeScript 之间转换
这是专门探索 JavaScript 及其所构建的组件的系列文章的第 15 篇. 如果你错过了前面的章节,可以在这里找到它们: JavaScript 是如何工作的:引擎,运行时和调用堆栈的概述! Jav ...
- 《React设计模式与最佳实践》笔记
书里的demo都是15.3.2以下版本的,有些demo用最新的react 16.x版本会报错,安装包的时候记得改一下版本 第一章 React 基础 命令式编程描述代码如何工作,而声明式编程则表明想 ...
- Windows中通过命令行新建文件夹、新建文件,和一些常用命令
新建文件 和Linux不太一样,Linux中的touch和vi命令创建新文件的方法都不能用了,在windows命令行下得用type nul>文件名.后缀名来创建: F:\study\vue\wo ...
- 解决Centos7 yum 出现could not retrieve mirrorlist 错误
刚通过VMware12安装了centos7.x后,使用ip addr查看centos局域网的ip发现没有,使用yum安装一些工具包时也出现报错: Loaded plugins: fastestmirr ...
- 【阿里云】在 Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务
Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务 一.安装 Filezilla Server 下载最新版本的 Filezilla Server ...
- jupyter notebook安装、登录
pip install jupyter 提示pip需要升级(本人装的是anaconda) 输入:python -m pip install --upgrade pip 安装完成. 运行jupyter ...
- WPF:在DataTemplate中使用DataType
DataTemplate中的DataType的功能实际上和Style中的TargetType很类似. 在Style中,使用了TargetType之后,如果不定义Style的Key,那么这个Style将 ...
- 【Linux】【Apatch Tomcat】Linux、CentOS7安装最新版Apartch Tomcat环境
1.前言 相当嫌弃,博客园搞掉了我快写完的 Tomcat. 请先安装 :[Linux][Java]CentOS7安装最新版Java1.8.191运行开发环境 虽然安装Tomcat没啥技术,但是还是记录 ...
- 结对编程项目——C语言实现WordCount Web化
结对编程项目 代码地址 201631062219,201631011410 gitee项目地址:https://gitee.com/xxlznb/pair_programming 作业地址:https ...