You are not logged in.

#1 2015-01-14 14:51:15

gaelic
Member
Registered: 2010-08-01
Posts: 111

systemd commandline output

Dear Folks,

If I have e.g. a config error in my sshd_config running by hand

systemctl restart sshd.service

gives me no message wether the daemon was able to start or not.
But running stop followed by a start gives me:

systemctl stop sshd.service
systemctl start sshd.service

Job for sshd.service failed. See "systemctl status sshd.service" and "journalctl -xe" for details.

How can I turn on this behaviour by default. It is quite annoying to always run 'status' after a restart just to check if there was a problem. Even more if a start shows me the message in the terminal.

Thx

Offline

#2 2015-01-14 22:06:40

\hbar
Member
Registered: 2014-03-15
Posts: 165

Re: systemd commandline output

How about defining a bash function like

function systemctl-restart { systemctl stop $1; systemctl start $1 }

Offline

#3 2015-01-16 19:39:09

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: systemd commandline output

gaelic wrote:

Dear Folks,

If I have e.g. a config error in my sshd_config running by hand

systemctl restart sshd.service

gives me no message wether the daemon was able to start or not.
But running stop followed by a start gives me:

systemctl stop sshd.service
systemctl start sshd.service

Job for sshd.service failed. See "systemctl status sshd.service" and "journalctl -xe" for details.

How can I turn on this behaviour by default. It is quite annoying to always run 'status' after a restart just to check if there was a problem. Even more if a start shows me the message in the terminal.

Thx

Well, bug people at systemd-devel ML... I would do it myself, but I think there is little point because systemd's error reporting is terrible anyway (there are many other "quircks" like the one you found). For example, "job for sshd.service failed" does not mean that "sshd failed to start". So, when starting a new service, I'd suggest to not rely on systemctl no matter what it says (or doesn't say), but always check ps(1) and logs.

Last edited by Leonid.I (2015-01-16 19:40:49)


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#4 2015-01-16 21:02:20

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: systemd commandline output

The restart doesn't execute stop&start; it sends a signal to the current process which has many benefits (for example; you can do it over an ssh connection). Doesn't the journal show anything when you execute the restart?

Offline

#5 2015-01-16 21:35:18

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,280

Re: systemd commandline output

run journalctl as root to get all the output.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2015-01-16 22:23:35

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: systemd commandline output

Spider.007 wrote:

The restart doesn't execute stop&start; it sends a signal to the current process which has many benefits (for example; you can do it over an ssh connection). Doesn't the journal show anything when you execute the restart?

You mean reload, not restart. These are different actions.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#7 2015-01-19 07:22:45

gaelic
Member
Registered: 2010-08-01
Posts: 111

Re: systemd commandline output

Leonid.I wrote:
Spider.007 wrote:

The restart doesn't execute stop&start; it sends a signal to the current process which has many benefits (for example; you can do it over an ssh connection). Doesn't the journal show anything when you execute the restart?

You mean reload, not restart. These are different actions.

I also think that thats the purpose of reload and restart really "restarts" the process (stop + start). And in my opinion it should give a message if it fails (or it worked). Just as during startup. There is an OK message ...
Of course I can always check the logs. But one should only go to the logs if something went wrong, and for that a message would be nice.

Offline

Board footer

Powered by FluxBB