From 5d5899b3d851ca33040364c525efa6f0c469a8d8 Mon Sep 17 00:00:00 2001 From: Myned Date: Mon, 13 Mar 2023 02:58:40 -0500 Subject: [PATCH] Fix relative path in systemd service file --- README.md | 10 +++++++--- watcher.service | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 57e7f4e..5a63fe2 100644 --- a/README.md +++ b/README.md @@ -57,15 +57,19 @@ cd Watcher ``` cp watcher.service ~/.config/systemd/user ``` -3. Reload user daemon +3. Replace `user` in `WorkingDirectory` with current user +``` +sed -i "s|\(WorkingDirectory=/home/\)user|\1$(whoami)|" ~/.config/systemd/user/watcher.service +``` +4. Reload user daemon ``` systemctl --user daemon-reload ``` -4. Start and enable service on login +5. Start and enable service on login ``` systemctl --user enable --now watcher ``` -5. Enable lingering to start user services on boot +6. Enable lingering to start user services on boot ``` sudo loginctl enable-linger username ``` diff --git a/watcher.service b/watcher.service index 498a44d..8957077 100644 --- a/watcher.service +++ b/watcher.service @@ -4,7 +4,7 @@ Requires=default.target After=default.target [Service] -WorkingDirectory=~/.git/Watcher +WorkingDirectory=/home/user/.git/Watcher ExecStart=poetry run python -OO run.py >&2 [Install]