Create Mono systemd service

This commit is contained in:
coolneng 2021-05-11 12:55:34 +02:00
parent db996d5cd5
commit 6315ab62af
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 22 additions and 0 deletions

View File

@ -96,4 +96,26 @@
host all all ::1/128 trust host all all ::1/128 trust
''; '';
}; };
# Run Mono server
systemd.services.mono-server = {
description = "Mono server to run ASP .NET applications";
wantedBy = [ "default.target" ];
path = with pkgs; [ mono6 ];
script = ''
lockfile=/tmp/mono-service
${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/gcw -l:$lockfile
${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/few -l:$lockfile
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
User = "nginx";
Group = "nginx";
ExecStop = ''
kill `cat $lockfile`
'';
};
before = [ "nginx.service" ];
};
} }