Can systemd version be upgraded to v240 or higher on Centos 7?

Viewed 609

Currentl I'm facing an issue where I would like to redirect stdout/stderr to specific log files. I have a created a service file for systemd service where I have added the steps for redirection, which is not working because current version 219 of systemd on the system does not support it and would require v240+ to work. My machine is CentOS 7.7.

Service file:
=============
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service nss-user-lookup.target

[Service]
User=jams
#Type=forking
WorkingDirectory=/opt/workspace/Dashboard/source-code/dashboard/
ExecStart=/opt/workspace/.env/bin/python kafka_consumer.py
StandardOutput=append:/data/dashboard/access.log
StandardError=append:/data/dashboard/error.log
Restart=always

[Install]
WantedBy=multi-user.target


$ systemctl --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN

$ cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)

Sorry, I'm not much familiar and have very less knowledge about this. Is it possible to upgrade the version of systemd to v240 or higher on CentOS 7.7 ? If yes, could anyone please point me in the right direction to get the source code and with the steps to build the package ?

Or, any alternatives ?

1 Answers

I see the question is rather old, but if you are still searching for a solution then something like this could work:

ExecStart=/opt/workspace/.env/bin/python kafka_consumer.py >> /data/dashboard/access.log 2>>/data/dashboard/error.log

A similar solution works for me for a similar problem on CentOS 7 with systemd 219.

Related