Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Run a systemd service as a user
# How to create systemd services: http://neilwebber.com/notes/2016/02/10/making-a-simple-systemd-file-for-raspberry-pi-jessie/
# Digital ocean on a mongodb service: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
[Unit]
Description=Run SystemD as users
After=network.target
[Service]
Type=simple
User=[USER HERE]
WorkingDirectory=[USER HOME]
ExecStart=/bin/bash --login -c 'source [USER_HOME]/.bashrc; cd [Directory of command] && [COMMAND TO RUN]'
Restart=always
[Install]
WantedBy=multi-user.target
@alexbuzzbee

This comment has been minimized.

Copy link

@alexbuzzbee alexbuzzbee commented Feb 27, 2019

PR: this fork contains a number of simplifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment