「sudo systemctl が無効」の後、サービスを手動で開始できません。

「sudo systemctl が無効」の後、サービスを手動で開始できません。

起動時に開始されるサービスがありますが、手動で制御したいと思います。どこに行ってもsudo systemctl disable service必要な作業を行う必要があるというメッセージが表示されますが、サービスが完全に削除され、後で手動で開始できないようです。

$ sudo systemctl disable service
Removed /etc/systemd/system/multi-user.target.wants/service.service.
Removed /etc/systemd/system/service.service.

$ sudo systemctl start service
Failed to start service.service: Unit service.service not found

自動起動から削除したいのですが、必要に応じて起動を続けることができます。私は何を見逃していますか?


の出力は何ですかsystemctl cat

無効にする前に:

# /etc/systemd/system/service.service
[Unit]
Description=Service Name

[Service]
Type=simple
ExecStart=/usr/service/service <username>
Restart=on-failure

[Install]
WantedBy=multi-user.target

ベストアンサー1

これはservice.service実際のサービス名のエイリアスにすぎず、とマークされています/etc/systemd/system/service.service。これらのリンクは、サービスが無効になると削除されます。

努力するgrep "Alias=service.service" /etc/systemd/system/*。ヒットが発生すると、ファイル名は実際のサービス名になり、その名前を使用してサービスを開始、停止、および再アクティブ化できます。

おすすめ記事