From b0cac175dfcdf84291681098c8c2e59746e85f04 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sat, 4 Jul 2020 14:12:17 +0100 Subject: [PATCH] Created Daemonizing (markdown) --- Daemonizing.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Daemonizing.md diff --git a/Daemonizing.md b/Daemonizing.md new file mode 100644 index 0000000..e324e4a --- /dev/null +++ b/Daemonizing.md @@ -0,0 +1,24 @@ +If you aren't using a container, you'll likely want to daemonize jf-acccounts, so that it can run in the background and start at boot. + +## systemd +Most Linux distributions use systemd as an init service to start parts of the system, and various systems. A simple service file is included for this. +* Run + +``` +λ jf-accounts -i +Assuming executable path "/home/hrfee/.cache/pypoetry/virtualenvs/jellyfin-accounts-r2jcKHws-py3.8/bin/jf-accounts". +1: systemd +>: 1 +service written to the current directory +(/home/hrfee/projects/jellyfin-accounts/jf-accounts.service). +Place this in the appropriate directory, and reload daemons. +``` +* As above, choose systemd, and a service file `jf-accounts.service` will be placed in your current directory. +* If you wish to have jf-accounts run as the current user, place this in `~/.config/systemd/user/` (Creating the directories if necessary). + * Next, run `systemctl --user daemon-reload` to detect the new service. + * To start, you can run `systemctl --user start jf-accounts`. + * To enable (start at boot), you can run `systemctl --user enable jf-accounts`. +* If you wish to run as root, make sure jellyfin-accounts was installed with root privileges (e.g through `sudo pip install jellyfin-accounts`). A quick way to do this is to run `which jf-accounts`. If the resulting directory is in a user's home, you'll need to reinstall as root. + * Once you've made sure, place `jf-accounts.service` in either `/etc/systemd/system/` or `/lib/systemd/system/` (generally the latter is better). + * You can then run the same systemctl commands as above, but remove `--user` and run with `sudo`. + \ No newline at end of file