Skip to content

Commit 257bcdf

Browse files
authored
docs: running within systemd (#105)
Signed-off-by: Carlos A Becker <[email protected]>
1 parent 0185fd6 commit 257bcdf

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,47 @@ the OpenSSH is never used nor needed — you can even uninstall it if you want t
119119
Incidentally, there's no risk of accidentally sharing a shell because there's no
120120
default behavior that does that on Wish.
121121

122+
## Running with SystemD
123+
124+
If you want to run a Wish app with `systemd`, you can create an unit like so:
125+
126+
`/etc/systemd/system/myapp.service`:
127+
```service
128+
[Unit]
129+
Description=My App
130+
After=network.target
131+
132+
[Service]
133+
Type=simple
134+
User=myapp
135+
Group=myapp
136+
WorkingDirectory=/home/myapp/
137+
ExecStart=/usr/bin/myapp
138+
Restart=on-failure
139+
140+
[Install]
141+
WantedBy=multi-user.target
142+
```
143+
144+
You can tune the values bellow, and once you're happy with them, you can run:
145+
146+
```bash
147+
# need to run this every time you change the unit file
148+
sudo systemctl daemon-reload
149+
150+
# start/restart/stop/etc:
151+
sudo systemctl start myapp
152+
```
153+
154+
If you use a new user for each app (which is good), you'll need to create them
155+
first:
156+
157+
```bash
158+
useradd --system --user-group --create-home myapp
159+
```
160+
161+
That should do it.
162+
122163
###
123164

124165
## Feedback

0 commit comments

Comments
 (0)