Bug 15714: Add get_loglevels to koha-functions.sh
[srvgit] / debian / scripts / koha-functions.sh
index 8090fc5..87a84a1 100755 (executable)
@@ -100,6 +100,7 @@ is_zebra_running()
     local instancename=$1
 
     if daemon --name="$instancename-koha-zebra" \
+            --pidfiles="/var/run/koha/$instancename/" \
             --user="$instancename-koha.$instancename-koha" \
             --running ; then
         return 0
@@ -113,6 +114,7 @@ is_indexer_running()
     local instancename=$1
 
     if daemon --name="$instancename-koha-indexer" \
+            --pidfiles="/var/run/koha/$instancename/" \
             --user="$instancename-koha.$instancename-koha" \
             --running ; then
         return 0
@@ -121,8 +123,51 @@ is_indexer_running()
     fi
 }
 
+is_plack_enabled()
+{
+    local site=$1
+    local instancefile=$(get_apache_config_for $site)
+
+    if [ "$instancefile" = "" ]; then
+        return 1
+    fi
+
+    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-opac-plack.conf' \
+            "$instancefile" && \
+       grep -q '^[[:space:]]*Include /etc/koha/apache-shared-intranet-plack.conf' \
+            "$instancefile" ; then
+        return 0
+    else
+        return 1
+    fi
+}
+
+is_plack_running()
+{
+    local instancename=$1
+
+    if start-stop-daemon --pidfile "/var/run/koha/${instancename}/plack.pid" \
+            --status ; then
+        return 0
+    else
+        return 1
+    fi
+}
+
 get_instances()
 {
     find /etc/koha/sites -mindepth 1 -maxdepth 1\
                          -type d -printf '%f\n' | sort
 }
+
+get_loglevels()
+{
+    local instancename=$1
+    local retval=$(xmlstarlet sel -t -v 'yazgfs/config/zebra_loglevels' /etc/koha/sites/$instancename/koha-conf.xml)
+    if [ "$retval" != "" ]; then
+        echo "$retval"
+    else
+        echo "none,fatal,warn"
+    fi
+
+}