Running user process with systemd

General support questions
Post Reply
ThuMay23
Posts: 1
Joined: 2019/06/29 20:56:45

Running user process with systemd

Post by ThuMay23 » 2019/06/29 21:05:08

I have a user process which runs on :3000/tcp. I use cron @reboot to start it up automarically. Instead, I would like to use systemd to manage the process. I would like to start/stop/reload all with systemd. I can get sudo systemctl but thats about all I can get. Is it possible to all of this with Centos 7.4?

As I understand, systemd offers users the ability to manage services under the user's control with a per-user systemd instance, enabling users to start, stop, enable, and disable their own units.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Running user process with systemd

Post by TrevorH » 2019/06/29 22:17:47

First thing: run yum update as 7.4 is not only not supported, it's 2 years out of date and missing numerous high severity security fixes.

Yes, you can create a systemd unit file to do this but you need to be root to be able to do so as it requires write access to /etc/systemd/system/ (or to /usr/lib/systemd/system/ though that's not really intended for your own unit files). You will need to have sudo access to run things like /bin/systemctl start $unit and also stop/restart/status and maybe enable/disable as well to be able to control whether it starts on boot or not.

The systemd-user code is not part of CentOS/RHEL as Redhat have not enabled it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply