开机自启rc.local文件模板

#Ubuntu没有开机自启文件,可以在/etc/目录下面创建一个rc.local文件,并且给他一个可执行权限就行了
#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.
cd /root/
nohup /root/test.sh &
保存之后,不要忘记给 rc.local 添加可执行权限

chmod +x /etc/rc.local

转载请注明:exchen's blog » 解决ubuntu没有rc.local文件

 

posted @ 2022-08-15 14:10  往事已成昨天  阅读(174)  评论(0编辑  收藏  举报