]> granicus.if.org Git - icinga2/commitdiff
logrotate: Check whether the PID file exists
authorGunnar Beutner <gunnar@beutner.name>
Mon, 20 Apr 2015 09:15:59 +0000 (11:15 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 20 Apr 2015 09:25:10 +0000 (11:25 +0200)
refs #8808

etc/logrotate.d/icinga2.cmake

index 25e627f77f9c6afbb788c9e60d70f0109d94bb71..ba95e7bd7c414773802f590a9b01f91cdd6c1dd7 100644 (file)
@@ -7,8 +7,10 @@
        notifempty
        create 644 @ICINGA2_USER@ @ICINGA2_GROUP@
        postrotate
-               if ! kill -l USR1 `cat @ICINGA2_RUNDIR@/icinga2/icinga2.pid`; then
-                       exit 1
+               if service icinga2 status > /dev/null; then
+                       if [ -e @ICINGA2_RUNDIR@/icinga2/icinga2.pid ]; then
+                               kill -USR1 $(cat @ICINGA2_RUNDIR@/icinga2/icinga2.pid)
+                       fi
                fi
        endscript
 }