Ubuntu16.04开机启动的脚本一直不支持,错误用在将开机启动脚本放到了home/usr/的目录下,应该放到/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之前
sudo sh /xxx/xxx/restart.sh
:wq保存,再次重启服务器时nginx就自动执行restart.sh了。