From 445ecd6da7a33e89d6ed7afacafde487ed2550bc Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Thu, 12 Nov 2026 15:47:59 +0100 Subject: [PATCH] dotnetaspwebapi: start the service only once an app is deployed (#18639) --- install/dotnetaspwebapi-install.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/install/dotnetaspwebapi-install.sh b/install/dotnetaspwebapi-install.sh index 6898fd8f5..b6877e88f 100644 --- a/install/dotnetaspwebapi-install.sh +++ b/install/dotnetaspwebapi-install.sh @@ -97,6 +97,7 @@ msg_info "Creating Service" cat </etc/systemd/system/kestrel-aspnetapi.service [Unit] Description=.NET Web API App running on Linux +ConditionPathExists=/var/www/html/$var_project_name.dll [Service] WorkingDirectory=/var/www/html @@ -112,7 +113,18 @@ Environment=DOTNET_NOLOGO=true [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now kestrel-aspnetapi +cat </etc/systemd/system/kestrel-aspnetapi.path +[Unit] +Description=Start the .NET Web API App once it is deployed + +[Path] +PathExists=/var/www/html/$var_project_name.dll + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q kestrel-aspnetapi +systemctl enable -q --now kestrel-aspnetapi.path msg_ok "Created Service" motd_ssh