Sfoglia il codice sorgente

Added support for later versions of OS X

Previous check does not work via SSH. Using full path.
synner1 12 anni fa
parent
commit
c7f0543188
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      check_service.sh

+ 6 - 1
check_service.sh

@@ -90,9 +90,14 @@ if [[ $OS == freebsd ]]; then
 fi
 fi
 
 
 if [[ $OS == osx ]]; then
 if [[ $OS == osx ]]; then
-        if command -v serveradmin >/dev/null 2>&1 && serveradmin list | grep "$SERVICE" 2>&1 >/dev/null; then
+        if [ -f /usr/sbin/serveradmin >/dev/null 2>&1 ] && serveradmin list | grep "$SERVICE" 2>&1 >/dev/null; then
                 SERVICETOOL="serveradmin status $SERVICE"
                 SERVICETOOL="serveradmin status $SERVICE"
                 LISTTOOL="serveradmin list"
                 LISTTOOL="serveradmin list"
+        elif [ -f /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin >/dev/null 2>&1 ] && \
+               /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin list | \
+                grep "$SERVICE" 2>&1 >/dev/null; then
+                SERVICETOOL="/Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status $SERVICE"
+                LISTTOOL="/Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin list"
         elif command -v launchctl >/dev/null 2>&1; then
         elif command -v launchctl >/dev/null 2>&1; then
                 SERVICETOOL="launchctl list | grep -v ^- | grep $SERVICE || echo $SERVICE not running! "
                 SERVICETOOL="launchctl list | grep -v ^- | grep $SERVICE || echo $SERVICE not running! "
                 LISTTOOL="launchctl list"
                 LISTTOOL="launchctl list"