[Apparmor-general] how to get the status of the apparmor

S Kalyanasundaram skalyanasundaram at novell.com
Tue May 15 00:56:02 MDT 2007


Hi all,
  I wanted to reload the apparmor profiles through my script. I was doing

....
APPARMOR_INIT=/etc/init.d/boot.apparmor
$APPARMOR_INIT status
APPARMOR_RUNNING=$?

if [ "x$APPARMOR_RUNNING" = "x0" ]
then
        $APPARMOR_INIT restart
fi
....

      
But $? returns 0 in both the cases (start,stop). How do i get the status of the apparmor profile. Is there any environment variable that i can use?

i am planning something of this kind for now.

....
x=`rcapparmor status | grep "profiles are loaded" | cut -d' ' -f 1`
if [ $x -gt 0 ]
then
 rcapparmor restart
fi
....

Is there any better solution? Please suggest me.

Thanks in advance,
  -"kalyan"





More information about the Apparmor-general mailing list