From 811dbb29403873e1bab1309a74ccdce5e3ff21eb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 5 Aug 2018 23:01:54 +0200 Subject: [PATCH] systemd user service example --- in/public/init/systemd/services.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/in/public/init/systemd/services.rst b/in/public/init/systemd/services.rst index 545f96f..d4c0f20 100644 --- a/in/public/init/systemd/services.rst +++ b/in/public/init/systemd/services.rst @@ -13,3 +13,26 @@ user .. info:: enable-linger prevents daemon to be killed at session exit + +Example: + +* ~/.config/systemd/user/multi-user.target.wants/httpy.service + +.. code:: ini + + [Unit] + Description=httpy + After=network-online.target + Wants=network-online.target + + [Service] + ExecStart=/usr/bin/python3 -m http.server 8080 + WorkingDirectory=%h/www + Restart=always + + [Install] + WantedBy=multi-user.target + +.. info:: + + %h is replaced by the user's home directory