diff options
Diffstat (limited to 'local/sbin/user-service.sh')
-rwxr-xr-x | local/sbin/user-service.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/local/sbin/user-service.sh b/local/sbin/user-service.sh index e48bb9d..632272c 100755 --- a/local/sbin/user-service.sh +++ b/local/sbin/user-service.sh @@ -27,6 +27,7 @@ while [ -n "$1" ]; do echo " start - start service" echo " stop - stop service" echo " restart - restart service" + echo " ifrestart - restart service if it's running" ;; -q) Q=false @@ -83,6 +84,21 @@ case "$OP" in exit 1 fi ;; + ifrestart) + $Q && echo "Restarting service $NAME..." + if status; then + if ! stop; then + $Q && echo " stop failed" + exit 1 + fi + if start; then + $Q && echo " ok" + else + $Q && echo " start failed" + exit 1 + fi + fi + ;; *) echo "Invalid operation!" exit 3 |