initial upload
This commit is contained in:
commit
867ac1955d
10 changed files with 495 additions and 0 deletions
25
lighttpd_restart_oom.sh
Executable file
25
lighttpd_restart_oom.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Monitors if lighttpd uses too much mem, and if so, restarts it
|
||||
|
||||
# 100MB
|
||||
MAXRAM=200000
|
||||
|
||||
while true; do
|
||||
CHECK=$(ps auxww | grep 'lighttpd -f' | grep -v grep | awk '{print $6}')
|
||||
sleep 5
|
||||
|
||||
if [ $CHECK -gt $MAXRAM ]; then
|
||||
logger "lighttpd OOM ($CHECK KB used)"
|
||||
/etc/init.d/lighttpd stop
|
||||
sleep 15
|
||||
/etc/init.d/lighttpd start
|
||||
sleep 5
|
||||
elif [ -z $CHECK ]; then
|
||||
logger "lighttpd not running, starting"
|
||||
/etc/init.d/lighttpd start
|
||||
sleep 15
|
||||
else
|
||||
logger "lighttpd normal ($CHECK KB used)"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue