私はhttp-server
を使って簡単なAngularアプリケーションをサーバーに送ります。私がbashから実行すると、アプリケーションはうまく動作します。しかし、私がsystemdユニットファイルから実行しようとすると失敗します。httpdサーバがシステム内で起動していない
これは私が実行したシステムファイルです。
[Unit]
Description=web_app
Requires=network.target
After=multi-user.target
[Service]
ExecStart=/usr/bin/http-server -p 80
Type=forking
WorkingDirectory=/home/ubuntu/jenkins/workspace/deepcareweb_dev
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=web_app
User=root
#Group=<alternate group>
#Environment=NODE_ENV=production PORT=1337
[Install]
WantedBy=multi-user.target
systemdユニットファイルからhttp-server
を実行するにはどうすればよいですか?
編集1:それは「あまりにも早く繰り返し要求を開始します」エラーをトリガされるようsystemctl status
$ sudo systemctl status web_app
● web_app.service - web_app
Loaded: loaded (/etc/systemd/system/web_app.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Sun 2017-03-05 06:17:14 UTC; 10s ago
Process: 1879 ExecStart=/usr/bin/http-server -p 80 (code=exited, status=200/CHDIR)
Main PID: 1354 (code=exited, status=200/CHDIR)
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: web_app.service: Control process exited, code=exited status=200
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: Failed to start web_app.
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: web_app.service: Unit entered failed state.
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: web_app.service: Failed with result 'exit-code'.
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: web_app.service: Service hold-off time over, scheduling restart.
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: Stopped web_app.
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: web_app.service: Start request repeated too quickly.
Mar 05 06:17:14 ip-172-31-22-251 systemd[1]: Failed to start web_app.
どのように実行していますか、どのようなエラーが表示されていますか? –
@BurhanKhalid 'sudo systemctl start web_app'を実行すると、制御プロセスがエラーコードで終了したため、' Job for web_app.service failed failed。詳細については、「systemctl status web_app.service」と「journalctl -xe」を参照してください。 –
...ログの内容は何ですか? 'systemctl status web_app'? –