ubuntu设置开机启动脚本
rc.local脚本
rc.local脚本是一个ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令。该脚本位于/etc/路径下,需要root权限才能修改。
该脚本具体格式如下:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing. exit 0
注意: 一定要将命令添加在 exit 0之前
如何给ubuntu添加一个开机启动脚本
1,新建个脚本文件new_service.sh
#!/bin/bash
# command content exit 0
2,设置权限
sudo chmod 755 new_service.sh
3,把脚本放置到启动目录下
sudo mv new_service.sh /etc/init.d/
4,将脚本添加到启动脚本
执行如下指令,在这里90表明一个优先级,越高表示执行的越晚
cd /etc/init.d/
sudo update-rc.d new_service.sh defaults 90
移除Ubuntu开机脚本
sudo update-rc.d -f new_service.sh remove
总结
ubuntu设置开机启动脚本的更多相关文章
- Ubuntu 18.04 设置开机启动脚本 rc.local systemd
ubuntu18.04不再使用initd管理系统,改用systemd. ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.l ...
- ubuntu高版本如何设置开机启动脚本
ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本 可以通过下列简单设置后,可以使rc.local重新发挥作用. 1.建立rc-local.service文件 ...
- ubuntu-18.04 设置开机启动脚本-亲测有效
ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.local重新发挥作用. 2.将下列内容复制进rc-local.servi ...
- ubuntu-18.04 设置开机启动脚本
ubuntu-18.04 设置开机启动脚本 参阅下列链接 https://askubuntu.com/questions/886620/how-can-i-execute-command-on-sta ...
- Ubuntu 16.04设置开机启动脚本的方法
需求:公司卡片机容量太小,只有100G,由于使用的人比较的多,开机使用后有时候就会出现磁盘空间占满数据写不进去的情况,影响工作进度,而且每次使用完都得关掉卡片机,所以就有必要写个清理磁盘的脚本,当卡片 ...
- Ubuntu 14.04设置开机启动脚本的方法
rc.local脚本 rc.local脚本是一个ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令.该脚本位于/etc/路径下,需要root权限才能修改. 该脚本具体格式如下: #! ...
- Ubuntu编写开机启动脚本
1 概述 服务器一般不可能百分之百不会挂,于是一般采用主备或者分布式来达到高可用. 挂掉的机器有很多处理策略,常用的就是重新启动,但是为了保证重启之后服务器能够恢复可用状态,需要配置开机启动脚本. 2 ...
- Fedora 21 设置开机启动脚本
sudo touch /etc/rc.d/rc.localsudo vim /etc/rc.d/rc.local 在/etc/rc.d/rc.local文件中写入, 然后使用:wq命令 保存并退出. ...
- ubuntu设置开机启动图形应用程序,替换默认图形桌面
直接将启动程序放在rc.local即可.但是如果自动启动的程序奔溃后,会返回到ubuntu的unity桌面系统. 我遇到的问题是程序还有调用 xset 去定时关闭屏幕.在桌面启动后调用没问题.如果rc ...
随机推荐
- 測试赛C - Eqs(哈希)
C - Eqs Time Limit:5000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Stat ...
- stl之hash_multiset
hash_multiset的元素不会被自己主动排序
- PHPExcel 对xls表格的文件读取
//先去http://phpexcel.codeplex.com/releases/view/119187 下载文件包最后解压Classes到当前目录header("Content-type ...
- Mac 上的一些骚操作和技巧
0.自定义mac touch bar 上的图标 系统偏好设置-键盘-自定义control strip.. 接下来就精彩了:先用手指按住你touch bar 的siri,然后移到最左边的删除图标,将它移 ...
- Atitit.atiJsBridge 新特性v7q329
Atitit.atiJsBridge 新特性v7q329 atiJsBridge 未来计划 Postdata 图像上传的支持 Simp param计划 p1 p2 p3 p4 $method 的si ...
- Visual Studio - 安装VAX
安装方法: 我的VS2013装D盘了,安装VA以后,把VA_X.dll替换到下面的程序路径中即可完成破解. C:\Users\Administrator\AppData\Local\Microsoft ...
- 0053 用注解方式配置Spring MVC
按照0052中的办法,如果一个站点设计有1000个请求,那就得写1000个controller,还得配置1000个<bean id="helloController" cla ...
- django的html模板中获取字典的值
在django的html模板中获取字典中的值应当直接使用 字典.[key] 的方式 {% for i in lists %} <li id="{{i.id}}" class ...
- .net获取客户端IP
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Secu ...
- Jquery学习笔记(4)--checkbox全选反选
可能有浏览器兼容性,注意html里的checked是一个属性,存在就默认选中. <!DOCTYPE html> <html lang="en"> <h ...