你能为ubuntu上的nodejs建议一个upstart配置文件吗?我找到了以下教程:http://howtonode.org/deploying-node-upstart-monit但它看起来很旧。
答案 0 :(得分:0)
我有一个创建配置文件的shell脚本。
create_upstart() {
project=$1
file=$2
conf="/etc/init/${project}_${file}.conf"
cat > $conf << EOF
#!upstart
description "Node Process - $1"
author "Geert Pasteels"
respawn
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
script
export NODE_ENV="production"
export PORT="3001"
exec /usr/bin/node /var/www/$project/current/$file.js >> /var/www/$project/shared/logs/$file 2>&1
end script
EOF
echo $conf
# Restart upstart script
stop ${project}_${file}
start ${project}_${file}
echo Restarted ${project}_${file}
}
create_upstart "$1" "$2"
我将此与TJ's deploy结合使用。所以在我的post部署钩子中我做startup app file.