< ~wiki

daemonize all the things

so you've got a process that you want to keep running. you might have it in a tmux or screen session. let's use systemd user units to manage it!

  1. ensure that your user unit loadpath is set up:
mkdir -p ~/.config/systemd/user/
  1. create a basic service. save something like this in ~/.config/systemd/user/my-new-service.service (adjusting where necessary)

ExecStart=/bin/bash -c "while true do; echo hi; done"

  1. enable it
systemctl --user enable --now my-new-service.service
  1. enable-linger for your user account
loginctl enable-linger

this allows your user units to run even when you're not logged in.


you can now use systemctl --user to manage your daemonized process.