put some scripts from prix.aec.at in there and moved vpnc_config.sh to archive
This commit is contained in:
parent
0eea462dc3
commit
d5eab96a7d
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
freememory=$(free -m | grep "cache:" | awk '{print $4}')
|
||||
threshold="300"
|
||||
|
||||
|
||||
if [ $freememory -gt $threshold ]; then
|
||||
echo "There is $freememory MB availible. Threshold not reached."
|
||||
else
|
||||
echo "There is less than $threshold MB of memory availible."
|
||||
/home/david/mail.sh "There is less than $threshold MB of memory availible!! You should probably do something about that pretty soon brother!!"
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
###############################
|
||||
# #
|
||||
# mbots mail routine #
|
||||
# #
|
||||
###############################
|
||||
|
||||
# ***** config section *****
|
||||
#don't touch as long as you're not me. feel me?
|
||||
version=".01"
|
||||
author="david@socialnerds.org"
|
||||
|
||||
#script config
|
||||
smtpserver="smtp.aec.at"
|
||||
recipients="david@aec.at gerald.hochhauser@aec.at michael.grausgruber@aec.at daniel.weihrauch@aec.at"
|
||||
from="mbots@aec.at"
|
||||
subject="free memory on prix.aec.at"
|
||||
line=$1
|
||||
|
||||
#if [ -f $line ]; then
|
||||
# line=$(cat $line)
|
||||
#fi
|
||||
|
||||
# ***** start of script *****
|
||||
|
||||
#telnet connection
|
||||
{
|
||||
sleep 1
|
||||
echo "HELO $HOSTNAME"
|
||||
sleep 1
|
||||
echo "MAIL FROM: $from"
|
||||
sleep 1
|
||||
for address in $recipients; do
|
||||
echo "RCPT TO: $address"
|
||||
sleep 1
|
||||
done
|
||||
echo "DATA"
|
||||
sleep 1
|
||||
for address in $recipients; do
|
||||
echo "To: $address"
|
||||
done
|
||||
echo "From: Monitoring Bots <$from>"
|
||||
echo "Subject: $subject"
|
||||
sleep 1
|
||||
echo "$line"
|
||||
sleep 1
|
||||
echo "."
|
||||
sleep 1
|
||||
echo "QUIT"
|
||||
} | telnet $smtpserver 25
|
||||
|
||||
|
||||
# ***** end of script *****
|
||||
#live long and prosper
|
||||
exit 0
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
i=1
|
||||
j=1
|
||||
threshold=850
|
||||
while [ 2 -gt 1 ]; do
|
||||
echo "run count: $i"
|
||||
sleep 30
|
||||
mem=$(free -m | grep + | awk '{print $3}')
|
||||
echo " used memory: $mem"
|
||||
echo " threshold: $threshold"
|
||||
if [ $mem -gt $threshold ]; then
|
||||
echo " memory usage too high"
|
||||
echo " too high mem count: $j (apache will be restarted if count reaches 10)"
|
||||
let j++
|
||||
if [ $j -gt 10 ]; then
|
||||
echo " resetting apache to clear memory"
|
||||
/etc/init.d/apache2 restart
|
||||
j=1
|
||||
fi
|
||||
else
|
||||
echo " memory below threshold"
|
||||
fi
|
||||
let i++
|
||||
done
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue