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,146
  • 3
  • 21
  • 27
  • That's the output of `initctl start`, which is what `service` devolves to on upstart systems with upstart jobs. The "new" output is the behaviour of `systemctl start` which is what `service` is devolving to. – JdeBP May 03 '15 at 20:21

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,306
  • 5
  • 30
  • 49
rm-vanda
  • 3,146
  • 3
  • 21
  • 27
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,306
  • 5
  • 30
  • 49