]> git.pld-linux.org Git - packages/audit.git/commitdiff
load audit rules only if auditd started
authorElan Ruusamäe <glen@delfi.ee>
Thu, 27 Jun 2013 05:25:44 +0000 (08:25 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Thu, 27 Jun 2013 05:25:44 +0000 (08:25 +0300)
auditd.init

index f5d13027ae40ef63d240ca11f5e2d0000195680d..7a4c0903eb20db003524f50da209abdbe6ea810d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# auditd        This starts and stops auditd
+# auditd       This starts and stops auditd
 #
 # chkconfig: 2345 18 87
 # description: This starts the Linux Auditing System Daemon
@@ -10,6 +10,8 @@
 # config: /etc/auditd.conf
 # pidfile: /var/run/auditd.pid
 
+PATH=/sbin:/bin:/usr/bin:/usr/sbin
+
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -26,13 +28,19 @@ start() {
                return
        fi
 
+       local rc
        msg_starting auditd
        unset HOME MAIL USER USERNAME
        daemon /sbin/auditd "$EXTRAOPTIONS"
        RETVAL=$?
+       # Load the default rules if daemon started
+       if [ $RETVAL -eq 0 ] && [ -f $AUDIT_RULES ]; then
+               /sbin/auditctl -R $AUDIT_RULES >/dev/null
+               rc=$?
+               # add error code, if it was an error
+               [ $rc -ne 0 ] && RETVAL=$rc
+       fi
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/auditd
-       # Load the default rules
-       [ -f $AUDIT_RULES ] && /sbin/auditctl -R $AUDIT_RULES >/dev/null
 }
 
 stop() {
This page took 0.134184 seconds and 4 git commands to generate.