$ sudo vi /etc/init.d/nginx
android@localhost:~$ /etc/init.d/nginx
Usage: nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}
android@localhost:~$ /etc/init.d/nginx start
* Starting nginx nginx [fail]
android@localhost:~$ /etc/init.d/nginx status
* nginx is running
android@localhost:~$
?
#!/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
sudo chown root:root /etc/rc.local
sudo chmod 755 /etc/rc.local
sudo systemctl enable rc-local.service
Running in chroot, ignoring request.
当然不会,诀窍就在手机上Linux Deploy 这个APP里
初始化系统里面有两个选项,分别为“run-parts”和“sysv”,不知道是干什么用的。不必管他,默认即可(我的默认是“run-parts”)。
初始化路径 —> /etc/rc.local
就是这样,一般情况下只要把“初始化”打上勾就行了,这样就可以开机自动执行“rc.local”文件里的内容了,就是这么简单
设置自启动nginx(适用于其他软件)(LinuxDeploy里的Ubuntu)
原文:https://www.cnblogs.com/Luad/p/10409048.html