【发布时间】:2017-03-31 07:04:20
【问题描述】:
我也按照一些帖子和教程创建了一个脚本,以便在服务器重新启动时启动流星项目。我已经关注了How to run meteor on startup on Ubuntu server
中提到的答案然后我使用“chmod +x meteor-server.sh”授予脚本可执行权限。
我已尝试将此脚本放在 /etc/init.d 和 /etc/init 文件夹中,但重启后流星项目未启动。我正在使用 ubuntu 16.04。
如果你能告诉我我所做的错误,我将不胜感激。以下代码是我的“meteor.server.sh”脚本文件。
# meteorjs - meteorjs job file
description "MeteorJS"
author "Jc"
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Essentially lets upstart know the process will detach itself to the background
expect fork
# Run before process
pre-start script
cd /home/me/projects/cricket
echo ""
end script
# Start the process
exec meteor run -p 4000 --help -- production
【问题讨论】:
-
为什么不构建项目并运行生成的包?
-
感谢您的回复,我只是想在服务器重启后自动启动我的应用程序
-
但首先不推荐在生产环境中运行它。
-
我尝试在 systemd 上放置一个服务并从中调用脚本。但是还是不行
-
永远不要使用
meteor run --production在你的生产服务器上运行你的应用程序,真的——不要那样做。以下是一些你应该阅读的材料:stackoverflow.com/questions/21316344/…guide.meteor.com/deployment.html#never-use-production-flag
标签: linux meteor ubuntu-16.04