1

We already knew that from Ubuntu 15 and above are using systemd, however the famous and unbeatable SysV still supported.

But there is a small issue which annoying (me and whom may concern). I love the way SysV display output while I executed sudo service [name] restart|start|....

Is there any posiblities to bring it back? Like the old time we had with 14.04?

UPDATED

For example,

In 14.04, when I execute this command:

sudo service ssh restart

I will get an "output" message like this:

ssh stop/waiting
ssh start/running, process 83054

Regards.

  • What exactly do you mean by "Operating system display output"? – Jos May 12 '16 at 9:39
  • @Jos: I updated the question, please check. – Toan Nguyen May 12 '16 at 9:42
  • 1
    No, the systemd equivalent systemctl start ssh outputs nothing, and there is no --verbose option. There is only systemctl status ssh and journalctl --unit=ssh. – Jos May 12 '16 at 9:55
1

What you can do is to write your own alias functions to do it. Simple alias woun't work because you need to get arguments from command line. That's why I wrote a functions with strange names, so they do not collapse with existing ones.

Here are mine ~/.aliases that are loaded in shell profile.

alias stop='__stp() { sudo systemctl stop "$1" && sudo systemctl status "$1" -n 2; }; __stp'
alias start='__str() { sudo systemctl start "$1" && sudo systemctl status "$1" -n 2; }; __str'
alias restart='__rst() { sudo systemctl restart "$1" && sudo systemctl status "$1" -n 2; }; __rst'
alias reload='__rld() { sudo systemctl reload "$1" && sudo systemctl status "$1" -n 2; }; __rld'
alias enable='__ebl() { sudo systemctl enable "$1" && sudo systemctl status "$1" -n 2; }; __ebl'
alias status='sudo systemctl status'

Then just run:

restart ssh

It outputs the next command systemctl status with additional argument -n 2 to show only last 2 lines from journal log file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.