start-stop-daemon はプロセスの失敗にもかかわらず常に "0" を返します。

start-stop-daemon はプロセスの失敗にもかかわらず常に

初期化スクリプトジョブの開始ノードjsデーモンプロセスとして。問題は、実行時にstart-stop-daemonnodejs-daemonがエラーを返しても常に「0」を返すことです。

スイッチを使用するとこの問題がstart-stop-daemon発生することがわかりました--background

スイッチ付start-stop-daemonnodejs-daemonが失敗しても常に「0」を返します。

root# start-stop-daemon --start --chuid $GHOST_USER:$GHOST_GROUP --chdir $GHOST_ROOT --make-pidfile --pidfile $PIDFILE --exec $DAEMON  --background -- $DAEMON_ARGS ; echo ---error: $?
---error: 0

デーモンは自動的に失敗し、現在実行されていません。

スイッチなし、私達は実際にできますバラよりデーモンプロセスを開始できません。

root# start-stop-daemon --start --chuid $GHOST_USER:$GHOST_GROUP --chdir $GHOST_ROOT --make-pidfile --pidfile $PIDFILE --exec $DAEMON  -- $DAEMON_ARGS ; echo ---error: $?
ERROR: Unsupported version of Node
Ghost needs Node version ~0.10.0 || ~0.12.0 || ^4.2.0 you are using version 5.10.0

Please see http://support.ghost.org/supported-node-versions/ for more information
---error: 231

--background今、私はそのスイッチを使ってnodejsデーモンを起動できないときに「0」より大きいエラーコードを得ることができる解決策を探しています。

ベストアンサー1

これは文書化された動作です。フォアグラウンドプロセスはバックグラウンドプロセスをフォークした後に完了します。マニュアルページから:

-b, --background
          Typically used with programs that don't detach on their own. This option will force start-stop-daemon to fork before starting the process, and  force
          it  into  the  background.   Warning:  start-stop-daemon  cannot check the exit status if the process fails to execute for any reason. This is a last
          resort, and is only meant for programs that either make no sense forking on their own, or where it's not feasible to add the code for them to do this
          themselves.

おすすめ記事