Linuxシステムにワーカーサービスをインストールする方法

Linuxシステムにワーカーサービスをインストールする方法

.Net Coreを使用してセカンダリサービスを作成しました。出力ファイルがあります.dll。 Gnu / Linuxオペレーティングシステム(Ubuntu Serverで実行されているなど)にインストールしたいと思います。Oracleバーチャルボックス

.dllファイルを仮想マシンにドラッグしてフォローしました。Linuxサーバーへのnet-core-serviceのインストール記事ですが明確ではありません。

誰かがサービスのインストールを支援できますか?

この設定ファイルがあります。

[Unit]
Description=Dummy Service in .NET
# Requires=xyz.service
# After=xyz.service

[Service]
Type=forking
WorkingDirectory=/user/iqan
ExecStart=dotnet DummyService/bin/debug/DummyService.dll

[Install]
WantedBy=multi-user.target

ベストアンサー1

システムサービスユニットファイルを次のように変更します。

[Unit]
Description=Dummy Service in .NET
# Requires=xyz.service
# After=xyz.service

[Service]
Type=simple
ExecStart=/usr/bin/dotnet  /home/linux/Downloads/DummyService.dll

[Install]
WantedBy=multi-user.target

その後実行

sudo systemctl daemon-reload

サービスの開始/停止/状態化に使用されます。

sudo systemctl start dummyservice.service
sudo systemctl stop dummyservice.service
sudo systemctl status dummyservice.service

おすすめ記事