Ubuntu 创建开机自启动脚本的方法

1) 将你的启动脚本复制到 /etc/init.d目录下

以下假设你的脚本文件名为 test.sh。

2) 设置脚本文件的权限

$ sudo chmod 755 /etc/init.d/test.sh

3) 执行如下命令将脚本放到启动脚本中去:

1$ cd /etc/init.d 2$ sudo update-rc.d test.sh defaults 95

注:其中数字95是脚本启动的顺序号,按照自己的需要相应修改即可。在你有多个启动脚本,而它们之间又有先后启动的依赖关系时你就知道这个数字的具体作用了。该命令的输出信息参考如下:

1update-rc.d: warning: /etc/init.d/test.sh missing LSB information 2update-rc.d: see <http://wiki.debian.org/LSBInitScripts> 3  Adding system startup for /etc/init.d/test.sh ... 4    /etc/rc0.d/K95test -> ../init.d/test.sh 5    /etc/rc1.d/K95test -> ../init.d/test.sh 6    /etc/rc6.d/K95test -> ../init.d/test.sh 7    /etc/rc2.d/S95test -> ../init.d/test.sh 8    /etc/rc3.d/S95test -> ../init.d/test.sh 9    /etc/rc4.d/S95test -> ../init.d/test.sh 10    /etc/rc5.d/S95test -> ../init.d/test.sh

卸载启动脚本的方法:

1$ cd /etc/init.d 2$ sudo update-rc.d -f test.sh remove

命令输出的信息参考如下:

1Removing any system startup links for /etc/init.d/test.sh ... 2    /etc/rc0.d/K95test.sh 3    /etc/rc1.d/K95test.sh 4    /etc/rc2.d/S95test.sh 5    /etc/rc3.d/S95test.sh 6    /etc/rc4.d/S95test.sh 7    /etc/rc5.d/S95test.sh 8    /etc/rc6.d/K95test.sh
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

Ubuntu18开启redis服务自启动

设置redis服务开机自启动。1.创建配置文件夹sudomkdir/etc/redissudocp/usr/local/redis/redis.conf/etc/redissudocp/etc/redis/redis.conf/etc/redis/6379.conf2.

Linux配置redis开机启动(CentOS 7)

https://blog.csdn.net/qq\_31803503/article/details/79246205本次配置linux版本是CentOS7_首先将 redis3.2.3/utils目录下的redis\_init\_script脚本拷贝到 /etc/init.d下修改名字为 redis_\root@lo

Elasticsearch 2.3.0 安装成服务

linux下作为服务Elasticsearch创建了debian安装包和rpm安装包,可以在官网的下载页面中进行下载。安装包需要依赖JAVA,除此就没有任何依赖。在debian系统下可以使用标准的系统工具,init脚本放在 /etc/init.d/elasticsearch下,配置文件默认放在 /etc/default/elastics

Linux常用软件启动、停止、重启命令

一、PHP启动命令:/usr/local/php5/sbin/phpfpm停止命令:pkillphpfpm二、MySQL启动命令:/etc/init.d/mysqldstart停止命令:/etc/init.d/mysqldstop重启命令:/etc/