diff --git a/README.md b/README.md index 9bd5ad0..4582f4e 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,22 @@ details, see syntax at https://goo.gl/R74nmi). If an arg is specified in more than one place, then commandline values override config file values which override defaults. ``` + +### Per-user systemd service +Copy the systemd service file from `systemd-user` folder to a location +suitable for user-defined systemd services (typically +`$HOME/.config/systemd/user`). + +Modify the `WorkingDirectory` directive to point to the location of the +installation, and `ExecStart` directive to configure how `fake.py` is run. + +To start the service and enable it so that it is run after login, run the +following (as normal user): +``` +$ systemctl --user start fakecam.service +$ systemctl --user enable fakecam.service +``` + ## License The source code of this repository are released under GPLv3. diff --git a/systemd-user/fakecam.service b/systemd-user/fakecam.service new file mode 100644 index 0000000..ed95de6 --- /dev/null +++ b/systemd-user/fakecam.service @@ -0,0 +1,26 @@ +# systemd user unit file for Linux-Fake-Background-Webcam +# place this file into a location suitable for user-defined systemd units +# (e.g $HOME/.config/systemd/user) +# +# To enable and run the fakecam service, run +# systemctl --user enable fakecam.service +# systemctl --user start fakecam.service + +[Unit] +Description=Fake camera +After=network.target + +[Service] +Type=simple +# specify working directory such as Git project directory +# %h expands to the $HOME directory of the user running the service +WorkingDirectory=%h/devel/fangfufu/Linux-Fake-Background-Webcam +# you can use command line options here, or point the script +# to your config file +ExecStart=python3 fake.py -c %h/.config/fakecam/config.ini +# fake.py exits when pressing Ctrl + \ which corresponds to SIGQUIT +# so we need to specify this kill signal instead of SIGINT +KillSignal=SIGQUIT + +[Install] +WantedBy=default.target