Bug 10670: ensure koha-start-zebra sets problem permissions for logs
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 1 Aug 2013 11:26:03 +0000 (13:26 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 14 Nov 2013 23:53:10 +0000 (23:53 +0000)
If koha-common is started when Zebra log files are owned by root
it will fail to start without any useful message (since Zebra can't
write errors in log files because it lacks permissions to do so).

This patch creates empty log files and ensure they have correct
permissions.

I can't pin-point why log files gets owned root, but I suspect it
has something to do with Zebra crashing and logrotate, but this is
just theory. We have seen this behaviour since koha 3.1 every
few months, and every time it happends we have root owned logs and
crashed Zebra so this patch will at least help sites which have
some kind of automatic koha-common start if it's not running.

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
debian/scripts/koha-start-zebra

index 222b0ef..f63ab42 100755 (executable)
@@ -77,6 +77,13 @@ start_zebra_instance()
 
     if is_enabled $instancename; then
         echo "Starting Zebra server for $instancename"
+        touch "/var/log/koha/$instancename/zebra-error.log" \
+            "/var/log/koha/$instancename/zebra.log" \
+            "/var/log/koha/$instancename/zebra-output.log"
+        chown "$instancename-koha:$instancename-koha" \
+            "/var/log/koha/$instancename/zebra-error.log" \
+            "/var/log/koha/$instancename/zebra.log" \
+            "/var/log/koha/$instancename/zebra-output.log"
         daemon \
             --name="$instancename-koha-zebra" \
             --errlog="/var/log/koha/$instancename/zebra-error.log" \