在15.04,`service`不再提供有用的输出(状态除外)?
曾经是这样的情况
service service-name reload|restart|start|stop
– 会显示一个很好的:
service-name start/running, process 17642
现在,虽然新的status
输出真的很酷 – 我真的想保持原来的方式 – 它在stop|start|restart|reload
时提供某种[OK]
stop|start|restart|reload
– 有没有办法做到这一点?
至少,像脚本和别名这样的东西可能会成功,这里……
也许:
#!/bin/sh # service-status service "$1" "$2" if [[ $2 != "status ]]; then service "$1" status fi
或者更好; 因为service
真的是systemctl
无论如何:
#!/bin/sh # service-status systemctl "$2" "$1" if [[ $1 != "status" ]]; then systemctl status "$1" fi
然后将其添加到.bashrc
或.bash_aliases
:
alias service="service-status";
我的脚本版本,它给出了输出的结果:
#!/bin/bash service "$1" "$2" if [[ $2 != "status" ]]; then service --status-all | grep "$1" fi