systemd in RHEL 7

Latest response

This Labor Day weekend, I thought I'd spend some time learning about Fedora's systemd.  The Wikipedia article for systemd states, "Support in Red Hat Enterprise Linux 7 also planned."  (And then includes the all-too-familiar "citation needed" link.)

 

That got me thinking about this Red Hat Enterprise Linux 7 Ideas group and something I wanted to mention about systemd.

 

systemctl, like the service utility that came before it, depends on the administrator knowing the name of the service.  For example, if I wanted to restart the CUPS daemon, should it be service cupsd restart or service cups restart?  There was no easy way to know without blindly trying both.  (In RHEL5, it is "cups", by the way.  But many other services did have the "d" for daemon on the end:  ntpd, sshd, etc.)

 

That's why I often just directly ran the init.d scripts.  Typing /etc/init.d/cups and then pressing TAB to tab-complete it let me quickly do whatever I needed to the service without having to guess the name.  That is one benefit Debian has over RHEL:  their init.d scripts all began with "rc" and were in the root user's $PATH.  So, the administrator could simply type rccups and press TAB to make sure it shouldn't be rccupsd.  The entire command turns out to be rccups restart, which is shorter than service cups restart.  (And you know how lazy us system administrators are.)

 

Sadly, it appears systemctl suffers the same problem.  I don't suppose there is a way to get systemctl to tab-complete service names?

Responses

 

This may help:

 

 

chkconfig

 

So without any parameter shows you all services and the "autostart" runlevels.

 

 

Kind regards,

 

 

Jan Gerrit

All,

 

And with systemd, to check the status of a loaded service you can use 'systemd-systemctl', and the systemd target links live in /etc/systemd/{system,user} (links to the specific service target in /usr/lib/systemd)

I'd go for a tab completion capability too.

 

Not that I advise this, but adding /etc/init.d to your path allows tab completion to work with the `service` command.  Hacky at best and I don't like the idea of /etc/init.d being in my path, but you CAN do it if you really want.

I use /etc/bash_completion.d/systemd-bash-completion.sh so that I get tab autocompletion and it spares me from having to remember the exact syntax.

And newer version of systemctl let people drop the .service suffix, so you can do systemctl start httpd instead of systemctl start httpd.service.

Shell completion and systemctl are a beautiful thing. Looking at the RHEL 7 beta, bash-completion will be installed by default w/ most of Anaconda's options, except "minimal". systemctl start [tab] [tab] makes it easy.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.