システムのワンショットは数週間後に無効になります(死)。

システムのワンショットは数週間後に無効になります(死)。

3 つのシステム構成が有効になっています。

  1. 実際に実行したいサービス(dotnetプロセス):
# systemd.conf
[Unit]
Description=MyService
After=network.target
StartLimitIntervalSec=0

[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple

User=deployer

# The path to the application root
WorkingDirectory=/srv/myapp/current/bin

ExecStart=/bin/bash -c "dotnet MyService.dll"

Restart=always
RestartSec=5s

Environment="ThreadPool_ForceMinWorkerThreads=200"
Environment="COMPlus_ThreadPool_ForceMinWorkerThreads=200"
Environment="COMPlus_ThreadPool_ForceMaxWorkerThreads=10000"

[Install]
WantedBy=multi-user.target
  1. タッチされたファイルを監視するために使用される再起動および再起動パス(上記のサービスの再起動がトリガされます):
# systemd-restarter.conf
[Unit]
Description=MyService restart
After=network.target

[Service]
Type=oneshot

ExecStart=/bin/bash -c "pkill -f 'dotnet MyService.dll'"

[Install]
WantedBy=multi-user.target
# systemd-restarter-path.conf
[Path]
PathModified=/srv/myapp/shared/restart.txt

[Install]
WantedBy=multi-user.target

数週間後、systemd-restarter-path.confとsystemd-restarter.confが突然停止(非アクティブ)状態になりましたが、その理由はわかりません。

デプロイに capistrano を使用するため、restart.txt ファイルに触れ、systemd がプロセスを再起動します。

systemctl コマンドの例:

# systemctl status restart-service.service
● restart-service.service - restart
   Loaded: loaded (/etc/systemd/system/restart-service.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sat 2020-10-10 00:41:11 UTC; 20h ago
 Main PID: 3037 (code=exited, status=0/SUCCESS)
# systemctl status restart.path
● restart.path
   Loaded: loaded (/etc/systemd/system/restart.path; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sat 2020-10-10 00:43:30 UTC; 20h ago

restart.path と restart-service.service で systemctl restart を実行すると、再び動作を開始します。または、サーバーを再起動するだけです。

restart.txtファイルの監視が停止した理由をご存知ですか?

ベストアンサー1

おすすめ記事