2014-04-11 56 views
2

我試圖在啓動時啓動一個簡單的nodejs應用程序,作爲使用systemd的概念證明,並且對於我的生活無法使其工作。Nodejs,Forever和SystemD啓動問題

它工作絕對沒問題,如果我做的: systemctl start simple-empty-app.service

但是,如果我重新啓動系統,它甚至不嘗試加載,似乎沒有要在系統日誌什麼,表明正在嘗試即使它(但還有一些systemd啓動信息,所以我知道systemd正在做它的東西......)。

.service腳本是這樣的:

[Unit] 
Description=This is an empty tiny app for testing the nodejs deployment agent 

[Service] 
StandardOutput=syslog 
SyslogIdentifier=simple-empty-app 
Type=forking 
Environment=ENV=production 
Environment=PATH=/usr/bin:/usr/local/bin 
WorkingDirectory=/var/opt/nodejs-agent/node_modules/simple-empty-app 
ExecStart=/usr/local/bin/forever start --pidFile /var/run/simple-empty-app.pid /var/opt/nodejs-agent/node_modules/simple-empty-app/app.js 
ExecStop=/usr/local/bin/forever stop /var/opt/nodejs-agent/node_modules/simple-empty-app/app.js 
PIDFile=/var/run/simple-empty-app.pid 
User=root 

重啓後systemctl status simple-empty-app.service表明這一點:

simple-empty-app.service - This is an empty tiny app for testing the nodejs deployment agent 
Loaded: loaded (/var/opt/nodejs-agent/node_modules/simple-empty-app/simple-empty-app.service; linked) 
Active: inactive (dead) 
CGroup: name=systemd:/system/simple-empty-app.service 

而只是爲了證明這一點手動啓動:

[email protected]:~# systemctl start simple-empty-app.service 
[email protected]:~# systemctl status simple-empty-app.service 
simple-empty-app.service - This is an empty tiny app for testing the nodejs deployment agent 
Loaded: loaded (/var/opt/nodejs-agent/node_modules/simple-empty-app/simple-empty-app.service; linked) 
Active: active (running) since Fri, 11 Apr 2014 17:34:24 +0100; 4s ago 
Process: 1558 ExecStart=/usr/local/bin/forever start --pidFile /var/run/simple-empty-app.pid /var/opt/nodejs-agent/node_modules/simple-empty-app/app.js (code=exited, status=0/SUCCESS) 
Main PID: 1566 (node) 

任何人有有任何想法嗎? 如果有幫助,顯然我已經從debian repo中回溯安裝了systemdsystemd-sysv,因爲它不是系統化的。 而我在喘息

回答

2

固定它,只需要以下部分:

[安裝] WantedBy = multi-user.target

+0

謝謝,我有救的問題 – bxfvgekd