标签:ystemd script 设置 serve class eve 重启 查看 网络
我的答复是网络不通;
客户把部署的服务器ip弄错了,并且服务器断电重启了。我的程序没有重启。
1. 配置nginx 自动启动 vim /usr/lib/systemd/system/nginx.service
[Unit] Description=nginx - high performance web server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s stop [Install] WantedBy=multi-user.target
2. 设置为自启动 systemctl enable nginx.service
1. 创建启动脚本,并授权 sudo vim /etc/init.d/fw.sh #!/bin/sh sudo -u sense java -jar /home/sense /fw/fwapp-1.2.jar > /var/log/fwapp.log 2>&1 & 说明: sudo -u sense 表示我按照sense用户执行(我的文件存储在{user.dir} 即就是home/sense) 授权 chmod 755 /etc/init.d/fw.sh 2. 添加到/etc/init.d/fw.sh rc.local中 sudo vim /etc/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. /bin/sh /etc/init.d/fw.sh exit 0 3. /etc/rc.local 添加到/etc/profile 中,开机重启,加载此文件;加载 /etc/rc.local,执行/bin/sh /etc/init.d/fw.sh sudo vim /etc/profile /etc/rc.local 执行 source /etc/profile 4. sudo reboot 重启。 netstat -tunlp 查看nginx 端口 springboot 端口。nginx 和springboot 都正常启动了。
ubuntu16.04 springboot 断电后重启:程序自动重启
标签:ystemd script 设置 serve class eve 重启 查看 网络
原文地址:https://www.cnblogs.com/xhzd/p/11959409.html