в продолжение темы
на примере nginx:
#!/bin/bash
triggerValue=15 # if the CPU use is above 90% send an email. DO NOT USE a DOT or COMMA!
tempFileName=tmp-la # some name of the temp file for the ps, grep data
uptime | sed -e ‘s/.* load average: \(.*\), \(.*\), \(.*\)/\1 \2 \3/’ | grep -v grep > /tmp/$tempFileName
export LINE
(
read LINE
while [ -n "$LINE" ]
do
set $LINE
read LINE
if [ $(echo "$1" | sed -e 's/\.[0-9]*//g’) -gt $triggerValue ]; then
/etc/init.d/nginx stop
sleep 20
/etc/init.d/nginx start
fi
done
)< /tmp/$tempFileName