Skip to content

Commit 55bb6e6

Browse files
committed
Add how to set stdout and stderr
1 parent bee794b commit 55bb6e6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

content/debian/services.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ nano ~/.config/systemd/user/SERVICE_NAME.service
4141
- You can also set the **user** to run as for system wide services (see [here](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#User=)).
4242
- You can set **environment variables** using `Environment=` (see [here](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#Environment) for more).
4343
- You can set **working directory** using `WorkingDirectory=` (see [here](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#WorkingDirectory=) for more).
44+
- You can set **standard output** using `StandardOutput=` (see [here](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardOutput=) for more) Note: **stderr** defaults to use the same path (I think, not tested but based on the docs).
4445

4546
```
4647
[Unit]
@@ -52,6 +53,7 @@ ExecStart=/bin/bash -c '/usr/bin/my_awesome_program >> /home/user/out.txt 2>&1'
5253
User=[Only allowed when running as root to set the user to use instead of root (see note above)]
5354
WorkingDirectory=[relative to another option root but absolute paths work]
5455
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
56+
StandardOutput=append:/my_folder/output.txt
5557
Type=simple
5658
Restart=always
5759

0 commit comments

Comments
 (0)