Skip to content

Commit 14f2bd2

Browse files
Dirk Kuypersqmfrederik
Dirk Kuypers
authored andcommitted
Add a documemtation section about how to add a systemd service
1 parent 1f9f41b commit 14f2bd2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,33 @@ Per default a symlink will by created in /usr/local/bin pointing to your applica
9898
my-app
9999
```
100100

101+
## Creating a Systemd Service
102+
103+
Add a `my-app.service` file to your project containing at least the following
104+
105+
```
106+
[Unit]
107+
Description=My awesome app
108+
109+
[Service]
110+
Type=simple
111+
ExecStart=/usr/local/bin/my-app
112+
113+
[Install]
114+
WantedBy=multi-user.target
115+
```
116+
117+
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.
118+
119+
```
120+
<Content Include="my-app.service" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="1755">
121+
<LinuxPath>/etc/systemd/system/my-app.service</LinuxPath>
122+
</Content>
123+
```
124+
125+
Make sure to set the Property `<InstallService>true</InstallService>` in your `.csproj` file.
126+
127+
101128
### Note
102129
You can invoke the packaging tools manually, using a MSBuild target instead of using the a .NET Core CLI tool:
103130

0 commit comments

Comments
 (0)