每当EC2重启发生时,我想启动nginx服务沿着其他几个node js应用程序。
我创建了rc.local
。
我添加了下面的代码行:
#/etc/startup_script.sh
#actual path to your script file.
/usr/bin/bash /etc/startup_script.sh &
exit 0
字符串
startup_script.sh:
sudo systemctl start nginx.service
#start pm2 services
pm2 start npm --name node_server1
pm2 start npm --name node_server2
pm2 start npm --name node_server3
pm2 start npm --name node_server4
pm2 save
型
获取以下错误
-- Reboot --
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: Starting /etc/rc.local Compatibility...
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: rc-local.service: Control process exited, code=exited, status=203/EXEC
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: rc-local.service: Failed with result 'exit-code'.
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: Failed to start /etc/rc.local Compatibility.
型
1条答案
按热度按时间yr9zkbsy1#
您需要先将该服务下载到您的Linux机器中:
字符串