Skip to content

Commit

Permalink
Add a documemtation section about how to add a systemd service
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Kuypers authored and qmfrederik committed Apr 25, 2024
1 parent 1f9f41b commit 14f2bd2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 14f2bd2

Please sign in to comment.