1

It used to be the case that

service service-name reload|restart|start|stop - would display a nice :

service-name start/running, process 17642

Now, while the new status output is really cool - I would really like to keep the old way - where it gives some kind of [OK] on stop|start|restart|reload - Is there any way to do this?

rm-vanda
  • 3,202

2 Answers2

1

At the very least,something like a script and an alias would probably do the trick, here...

Maybe:

#!/bin/sh
# service-status
service "$1" "$2" 
if [[ $2 != "status ]]; then
    service "$1" status
fi 

Or better yet; since service is really systemctl anyway:

#!/bin/sh
# service-status 
systemctl "$2" "$1" 
if [[ $1 != "status" ]]; then 
    systemctl status "$1"
fi

and then add this to your .bashrc or your .bash_aliases:

alias service="service-status";
derHugo
  • 3,376
  • 5
  • 34
  • 52
rm-vanda
  • 3,202
0

My version of script, that gives me the result to the output:

#!/bin/bash
service "$1" "$2"
if [[ $2 != "status" ]]; then
    service --status-all | grep "$1"
fi
derHugo
  • 3,376
  • 5
  • 34
  • 52