Provide Best Programming Tutorials

Ubuntu 16.04添加开机启动脚本的方法

使用自带开机脚本

/etc/rc.local脚本是一个ubuntu16.04及其以前的系统中自带的开机脚本,在没有修改之前里面内容如下。

#!/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.

可以把开机要执行的命令放到 exit0 前面。

Leave a Reply

Close Menu