0
0

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 3 years have passed since last update.

Nest.js を Systemd で起動する

Posted at

こちらのサンプルを systemd で起動するようにしました。
Nest.js と TypeORM で MariaDB に接続

設定ファイルの作成

/etc/systemd/system/one_shot.service
[Unit]
Description=one_shot shell
After=netctl@profile.service

[Service]
Environment=NODE_PORT=3000
Type=simple
User=www-data
Restart=on-failure
WorkingDirectory=/home/uchida/nest/sample/05-sql-typeorm
ExecStart=npm start

[Install]
WantedBy=multi-user.target

起動

sudo systemctl start one_shot

状態の確認

$ sudo systemctl status one_shot
● one_shot.service - one_shot shell
     Loaded: loaded (/etc/systemd/system/one_shot.service; disabled; vendor pre>
     Active: active (running) since Fri 2021-02-12 13:03:33 JST; 42s ago
   Main PID: 92839 (node)
      Tasks: 35 (limit: 1064)
     Memory: 258.4M
     CGroup: /system.slice/one_shot.service
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?