11
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pm2でhubotをデーモン起動してみる

Posted at

なかなかないのでメモ。イマイチわからなかったのでいじってたらうまくいきました。

参考: http://nodejs.osser.jp/node/node-pm2/

##pm2のオプション

  • プロセスに名前をつける(ligco-cw) : --name プロセス名
  • node以外のコマンド実行: -f コマンド名 -x
  • コマンド実行に引数を渡す: -- 引数 / (例:slackアダプタ指定とBOT名指定) -- -a slack -n mybot

##実行

通常に起動する場合

$ bin/hubot -a chatwork -n ligco


pm2でデーモン化

$ pm2 start -f bin/hubot -x --name ligco-cw -- -a chatwork -n ligco

##確認

$ pmlist
┌──────────┬────┬──────┬───────┬────────┬───────────┬────────┬─────────────┬─────────────┐
│ App name │ id │ mode │ PID   │ status │ restarted │ uptime │      memory │    watching │
├──────────┼────┼──────┼───────┼────────┼───────────┼────────┼─────────────┼─────────────┤
│ ligco-cw │ 6  │ fork │ 17360 │ online │         0 │ 2m     │ 66.211 MB   │ unactivated │
└──────────┴────┴──────┴───────┴────────┴───────────┴────────┴─────────────┴─────────────┘
 Use `pm2 desc[ribe] <id>` to get more details
11
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?