Skip to content

Instantly share code, notes, and snippets.

@mmguero
Last active December 9, 2020 15:35
Show Gist options
  • Save mmguero/5c41ccaf6abbc2af18ab5560e53e2a70 to your computer and use it in GitHub Desktop.
Save mmguero/5c41ccaf6abbc2af18ab5560e53e2a70 to your computer and use it in GitHub Desktop.
systemctl user process howto
mkdir -p ~/.config/systemd/user/
sudo loginctl enable-linger $USER
---------------------------------------
~/.config/systemd/user/foobar.service
---------------------------------------
[Unit]
AssertPathExists=/home/johndoe/foo
[Service]
WorkingDirectory=/home/johndoe/foo
ExecStart=/home/johndoe/foo/bar
Restart=always
PrivateTmp=true
NoNewPrivileges=true
[Install]
WantedBy=default.target
---------------------------------------
systemctl --user enable foobar
systemctl --user start foobar
systemctl --user restart foobar
systemctl --user status foobar
systemctl --user stop foobar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment