ubuntu-18.04 设置开机启动脚本
ubuntu-18.04 设置开机启动脚本
参阅下列链接
ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.local重新发挥作用。
1、建立rc-local.service文件
sudo vi /etc/systemd/system/rc-local.service
2、将下列内容复制进rc-local.service文件
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local [Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99 [Install]
WantedBy=multi-user.target
3、创建文件rc.local
sudo vi /etc/rc.local
4、将下列内容复制进rc.local文件
#!/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.
echo "看到这行字,说明添加自启动脚本成功。" > /usr/local/test.log
exit 0
5、给rc.local加上权限
sudo chmod +x /etc/rc.local
6、启用服务
sudo systemctl enable rc-local
7、启动服务并检查状态
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
8、重启并检查test.log文件
cat /usr/local/test.log
如果能看到内容,说明设置成功,你就可以通过编辑rc.local文件来设置启动脚本了
ubuntu-18.04 设置开机启动脚本的更多相关文章
- Ubuntu 18.04 设置开机启动脚本 rc.local systemd
ubuntu18.04不再使用initd管理系统,改用systemd. ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.l ...
- Ubuntu 16.04设置开机启动脚本的方法
需求:公司卡片机容量太小,只有100G,由于使用的人比较的多,开机使用后有时候就会出现磁盘空间占满数据写不进去的情况,影响工作进度,而且每次使用完都得关掉卡片机,所以就有必要写个清理磁盘的脚本,当卡片 ...
- Ubuntu 14.04设置开机启动脚本的方法
rc.local脚本 rc.local脚本是一个ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令.该脚本位于/etc/路径下,需要root权限才能修改. 该脚本具体格式如下: #! ...
- ubuntu-18.04 设置开机启动脚本-亲测有效
ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.local重新发挥作用. 2.将下列内容复制进rc-local.servi ...
- Ubuntu14.04设置开机启动脚本(转)
原文:https://www.magentonotes.com/ubuntu-config-autostart-shell-script.html 方法一:将脚本添加到文件/etc/rc.local ...
- ubuntu-server-18.04 设置开机启动脚本
ubuntu-16.10 开始不再使用initd管理系统,改用systemd systemd is now used for user sessions. System sessions had al ...
- Ubuntu-18.04设置开机启动脚本
参考:https://www.cnblogs.com/defifind/p/9285456.html http://www.cnblogs.com/airdot/p/9688530.html s ...
- Ubuntu 16.04设置开机启动应用程序
在终端通过以下命令进行设置,Dash已经搜索不到Startup了: gnome-session-properties 或者直接在Dash中搜索:gnome-session
- ubuntu 18.04设置开机自动挂载移动硬盘
首先在命令行执行df -h指令,可以看到如下结果: zifeiy@zifeiy-PC1:~$ df -h 文件系统 容量 已用 可用 已用% 挂载点 udev 964M 0 964M 0% /dev ...
随机推荐
- VS2013添加重构重命名功能
VS2015.VS2017都自带重构重命名功能,早年用Eclipse的时候也频繁的使用这一功能,最近发现VS2013没有内置,需要装插件. 下载:https://marketplace.visuals ...
- spring boot 集成axis1.4 java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient
pom配置: <dependencies> <dependency> <groupId>org.springframework.boot</groupId&g ...
- SpringMVC是怎么工作的,SpringMVC的工作原理
SpringWeb MVC 是怎么工作的,SpringMVC的原理,SpringMVC源码 分析. 介绍 SpringWeb MVC是Spring Framework中的一部分,当我们需要使用spri ...
- 详解如何在 Linux 启动时自动执行命令或脚本
我一直很好奇,在启动 Linux 系统并登录的过程中到底发生了什么事情.按下开机键或启动一个虚拟机,你就启动了一系列事件,之后会进入到一个功能完备的系统中,有时,这个过程不到一分钟.当你注销或者关机时 ...
- log4j、使用log4j、打印sql日志
添加pom文件依赖 <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifa ...
- 使用Tornado异步接入第三方(支付宝)支付
目前国内比较流行的第三方支付主要有支付宝和微信支付,博主最近研究了下如何用Python接入支付宝支付,这里我以Tornado作为web框架,接入支付宝构造支付接口. 使用Tornado异步接入支付宝支 ...
- pdfjs预览pdf文件的两种方式(可复制)
1.以图片形式进行展示: version:采用1.x版本,2.0版本会有字体显示不完整的问题:参考 这里使用1.8.170 <script th:src="@{/pdfjs/build ...
- java笔记:排错5:误删maven target:恢复不了,怎么再生成
上篇讲过,误删maven项目的target,或clean以后,target文件夹会删掉. 想要重新加载模块生成最新的target目录,可以再跑一下tomcat. 但有时不灵,可能是因为Tomcat本身 ...
- 手写数字识别 ----Softmax回归模型官方案例注释(基于Tensorflow,Python)
# 手写数字识别 ----Softmax回归模型 # regression import os import tensorflow as tf from tensorflow.examples.tut ...
- ISP PIPLINE (十五) AF
主流的AF: CDAF, PDAF, laser assist AF(这个只是辅助,在微距或者拍摄纹理不明显的场景下好用). AF的大致原理就是检测图像锐度或者等价于锐度的参数,推动马达实现合焦或者对 ...