[root@mx12 /]# cat /opt/checkclam.sh
#!/bin/bash
if ! pgrep clamd > /dev/null;
then
/etc/init.d/clamd restart > /dev/null;
else
echo "OK `date +%T\ %F`" >> /program.log; #'\ ' is for space use %t for tab
fi
[root@mx12 /]# crontab -l
*/3 * * * * /opt/checkclam.sh
== == ===== ===== = = = === === ==== == = ========= =
The square brackets are useful to avoid the output of the
= = = = = = = = = = = = =Check SELINUX and turn it to permissive = = = = = = = = = = = = = =
#!/bin/bash
var1=`getenforce`
if [ "$var1" == "Permissive" ]
then
: # the " : " colon will do nothing or NO operation
else
/usr/sbin/setenforce 0
fi
#!/bin/bash
if ! pgrep clamd > /dev/null;
then
/etc/init.d/clamd restart > /dev/null;
else
echo "OK `date +%T\ %F`" >> /program.log; #'\ ' is for space use %t for tab
fi
[root@mx12 /]# crontab -l
*/3 * * * * /opt/checkclam.sh
== == ===== ===== = = = === === ==== == = ========= =
#!/bin/bash
# Check if gedit is running
if ps aux | grep "[h]ttdp" > /dev/null
then
echo "Running"
else
echo "Stopped"
fi
This script is just checking to see if the program "httpd" is running.The square brackets are useful to avoid the output of the
grep command. Without this the conditional will always return true, because the grep command start a process with the same content of the searched string.= = = = = = = = = = = = =Check SELINUX and turn it to permissive = = = = = = = = = = = = = =
#!/bin/bash
var1=`getenforce`
if [ "$var1" == "Permissive" ]
then
: # the " : " colon will do nothing or NO operation
else
/usr/sbin/setenforce 0
fi
============
[root@mailvm /]# cat selinuxcheck
#!/bin/bash
var1=`getenforce`
#if [ "$var1" == "Permissive" ]
#then
# :
#else
#/usr/sbin/setenforce 0
#fi
if [ "$var1" == "Enforcing" ]
then
echo "enforced mode"
printf "Now changing to Permissive"
sleep 1
printf "."
sleep 1
printf "."
/usr/sbin/setenforce 0
else
echo "permissive mode [OK]"
fi
echo
=============================================================================
No comments:
Post a Comment