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.

1 Answers1

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.

scorer
  • 111