fix codeblocks on user-units wiki page
This commit is contained in:
parent
ec713d9136
commit
e6b3e639af
|
@ -13,32 +13,30 @@ so you've got a process that you want to keep running. you might have it in a
|
||||||
tmux or screen session. let's use systemd user units to manage it!
|
tmux or screen session. let's use systemd user units to manage it!
|
||||||
|
|
||||||
1. ensure that your user unit loadpath is set up:
|
1. ensure that your user unit loadpath is set up:
|
||||||
```bash
|
|
||||||
mkdir -p ~/.config/systemd/user/
|
mkdir -p ~/.config/systemd/user/
|
||||||
```
|
|
||||||
|
|
||||||
1. create a basic service. save something like this in
|
1. create a basic service. save something like this in
|
||||||
`~/.config/systemd/user/my-new-service.service` (adjusting where necessary)
|
`~/.config/systemd/user/my-new-service.service` (using the name of the unit
|
||||||
```bash
|
you're creating)
|
||||||
[Unit]
|
|
||||||
Description=foo
|
|
||||||
|
|
||||||
[Service]
|
[Unit]
|
||||||
ExecStart=/bin/bash -c "while true do; echo hi; done"
|
Description=foo
|
||||||
|
|
||||||
[Install]
|
[Service]
|
||||||
WantedBy=default.target
|
ExecStart=/bin/bash -c "while true do; echo hi; done"
|
||||||
```
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
|
||||||
1. enable it
|
1. enable it
|
||||||
```bash
|
|
||||||
systemctl --user enable --now my-new-service.service
|
systemctl --user enable --now my-new-service.service
|
||||||
```
|
|
||||||
|
|
||||||
1. enable-linger for your user account
|
1. enable-linger for your user account
|
||||||
```bash
|
|
||||||
loginctl enable-linger
|
loginctl enable-linger
|
||||||
```
|
|
||||||
this allows your user units to run even when you're not logged in.
|
this allows your user units to run even when you're not logged in.
|
||||||
|
|
||||||
done!
|
done!
|
||||||
|
|
Loading…
Reference in New Issue