mirror of
https://github.com/quamotion/dotnet-packaging.git
synced 2026-07-08 18:06:08 +00:00
Add a documemtation section about how to add a systemd service
This commit is contained in:
committed by
Frederik Carlier
parent
1f9f41b604
commit
14f2bd2db4
27
README.md
27
README.md
@@ -98,6 +98,33 @@ Per default a symlink will by created in /usr/local/bin pointing to your applica
|
||||
my-app
|
||||
```
|
||||
|
||||
## Creating a Systemd Service
|
||||
|
||||
Add a `my-app.service` file to your project containing at least the following
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=My awesome app
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/my-app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Add the `my-app.service` file to an `<ItemGroup>` of your `.csproj` with the following content to make sure that it is installed at the right place.
|
||||
|
||||
```
|
||||
<Content Include="my-app.service" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="1755">
|
||||
<LinuxPath>/etc/systemd/system/my-app.service</LinuxPath>
|
||||
</Content>
|
||||
```
|
||||
|
||||
Make sure to set the Property `<InstallService>true</InstallService>` in your `.csproj` file.
|
||||
|
||||
|
||||
### Note
|
||||
You can invoke the packaging tools manually, using a MSBuild target instead of using the a .NET Core CLI tool:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user