ubuntu 开机启动shell脚本
1.创建shell启动脚本test
2.将启动脚本复制到 /etc/init.d 目录下
3.设置脚本文件权限
sudo chmod 755 /etc/init.d/test
4.设置脚本启动
sudo update-rc.d test defaults 95 //95 为启动优先级,越小优先级越高
// 执行后输出信息
update-rc.d: warning: /etc/init.d/test missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/test ...
/etc/rc0.d/K95test -> ../init.d/test
/etc/rc1.d/K95test -> ../init.d/test
/etc/rc6.d/K95test -> ../init.d/test
/etc/rc2.d/S95test -> ../init.d/test
/etc/rc3.d/S95test -> ../init.d/test
/etc/rc4.d/S95test -> ../init.d/test
/etc/rc5.d/S95test -> ../init.d/test
4.卸载启动脚本
sudo update-rc.d -f test remove
// 执行后输出信息
Removing any system startup links for /etc/init.d/test ...
/etc/rc0.d/K95test
/etc/rc1.d/K95test
/etc/rc2.d/S95test
/etc/rc3.d/S95test
/etc/rc4.d/S95test
/etc/rc5.d/S95test
/etc/rc6.d/K95test
其实解决办法就是在#!/bin/bash下面添加:
### BEGIN INIT INFO
# Provides: bbzhh.com
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: tomcat service
# Description: tomcat service daemon
### END INIT INFO
当然,也可以一劳永逸的:
apt-get remove insserv
ubuntu 开机启动shell脚本的更多相关文章
- Ubuntu 16.04设置rc.local开机启动命令/脚本的方法
Ubuntu 16.04设置rc.local开机启动命令/脚本的方法 Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启 ...
- 安装完Ubuntu后通过shell脚本一键安装软件
安装完Ubuntu后通过shell脚本一键安装软件 以下代码中#是单行注释 :<<! ! 是多行注释. 运行的时候需要把多行注释去掉. 比如把以下代码保存为install.sh, 那么在终 ...
- Centos创建定时任务和开机启动运行脚本
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAArYAAADlCAIAAAAp5CPLAAAgAElEQVR4nNS8d3cj15nuW/wq91vc8d ...
- (转) CentOS 7添加开机启动服务/脚本
CentOS 7添加开机启动服务/脚本 原文:http://blog.csdn.net/wang123459/article/details/79063703 一.添加开机自启服务 在CentOS 7 ...
- Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启动程序/服务)
注意:rc.local脚本里面启动的用户默认为root权限. 一.rc.local脚本 rc.local脚本是一个Ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令.该脚本位于/et ...
- Linux—添加开机启动(服务/脚本)
系统启动时需要加载的配置文件 /etc/profile./root/.bash_profile/etc/bashrc./root/.bashrc/etc/profile.d/*.sh./etc/pro ...
- 【centos7】添加开机启动服务/脚本
一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...
- PowerShell添加或修改注册表开机启动项脚本
代码如下: $name = Read-Host "请输入开机启动项的名字(随便起)" $value = Read-Host "请输入开机启动项的值" try{ ...
- centos7之添加开机启动服务/脚本
一.添加开机启动脚本 #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to ...
随机推荐
- 【Jmeter基础】 Linux上运行Jmeter
Jmeter 是一个强大的并发压测工具,常用于性能测试,压力测试,接口测试等领域.本文将介绍如下内容: 1. Jmeter 执行阶梯式压测 2. Jmeter 如何压测网站的js,css 等资源 3. ...
- Python 进阶_迭代器 & 列表解析
目录 目录 迭代器 iter 内建的迭代器生成函数 迭代器在 for 循环中 迭代器与字典 迭代器与文件 创建迭代器对象 创建迭代对象并实现委托迭代 迭代器的多次迭代 列表解析 列表解析的样例 列表解 ...
- HTML创建文本框的3种方式
我的第一个随笔,记录主要用来整理学习的知识点 1.input 创建单行文本框 <input type="text" size="10" maxlength ...
- 64.Find the Duplicate Number(发现重复数字)
Level: Medium 题目描述: Given an array nums containing n + 1 integers where each integer is between 1 ...
- Elasticsearch7.3开启x-pack验证
原文 Elasticsearch7开启x-pack验证 前言 在Elasticsearch7.3,x-pack已经作为默认的插件集成在Elasticsearch里面了,所以无需在bin/elastic ...
- link address
http://en.wikipedia.org/wiki/Software_design http://www.codeproject.com/Articles/70061/Architecture- ...
- A re-introduction to JavaScript (JS Tutorial) 转载自:https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
A re-introduction to JavaScript (JS Tutorial) Redirected from https://developer.mozilla.org/en-US/do ...
- ubuntu16.04安装jdk1.8(java1.8)
使用ppa方式安装 1.添加ppa $sudo add-apt-repository ppa:webupd8team/java $sudo apt-get update 2.安装oracle-java ...
- php函数练习20191031
<?php$str="what is you name?";$arr=array('i','s');$arr_1=array('s','i');//是先后替换的.echo s ...
- Centos7下编译安装php扩展redis5.0.2
安装环境:centos7 + php 7.2.191. 下载地址:http://pecl.php.net/get/redis-5.0.2.tgz .tgz http://pecl.php.net/ge ...