Last change
on this file since 1 was 1, checked in by alloc, 11 years ago |
Initial commit
|
-
Property svn:executable
set to
*
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1] | 1 | #!/bin/bash
|
---|
| 2 | . /etc/7dtd.conf
|
---|
| 3 |
|
---|
| 4 | if [[ "$MEM_NOTIFY_XMPP" = "no" ]]; then
|
---|
| 5 | if [[ "$MEM_NOTIFY_MAIL" = "no" ]]; then
|
---|
| 6 | exit
|
---|
| 7 | fi
|
---|
| 8 | fi
|
---|
| 9 |
|
---|
| 10 | PID=`$PIDOF 7DaysToDie.exe`
|
---|
| 11 |
|
---|
| 12 | if [[ -z "$PID" ]]; then
|
---|
| 13 | exit 0
|
---|
| 14 | fi
|
---|
| 15 |
|
---|
| 16 | USED_CUR_MB=`$FREE -m | $AWK '/buffers\/cache/{print $3;}'`
|
---|
| 17 | #USED_CUR_MB=`cat /proc/$PID/status | $AWK '/VmRSS/{print int($2/1024);}'`
|
---|
| 18 | TELNETPORT=$(($SDTD_PORT + 3))
|
---|
| 19 | #USED_CHUNKS=`echo -e "cc" | nc -q 3 127.0.0.1 $TELNETPORT | grep -a Mem | awk '/Chunk/{print $3;}'`
|
---|
| 20 |
|
---|
| 21 | if [ "$USED_CUR_MB" -gt "$MEM_NOTIFY_MAX_RAM" ]
|
---|
| 22 | then
|
---|
| 23 | MESSAGE="7dtd: $USED_CUR_MB MiB of memory used! Chunk memory: $USED_CHUNKS"
|
---|
| 24 | if [[ "$MEM_NOTIFY_XMPP" = "yes" ]]; then
|
---|
| 25 | echo $MESSAGE | sendxmpp -u $XMPP_USER -p $XMPP_PASSWORD -j $XMPP_SERVER -t $XMPP_TARGET
|
---|
| 26 | fi
|
---|
| 27 | if [[ "$MEM_NOTIFY_MAIL" = "yes" ]]; then
|
---|
| 28 | if [[ -n "$MAIL_USER" ]]; then
|
---|
| 29 | userparam="-xu $MAIL_USER"
|
---|
| 30 | fi
|
---|
| 31 | if [[ -n "$MAIL_PASS" ]]; then
|
---|
| 32 | passparam="-xp $MAIL_PASS"
|
---|
| 33 | fi
|
---|
| 34 | sendEmail -q -f $MAIL_FROM -t $MAIL_TO -u "$MAIL_SUBJECT" -m "$MESSAGE" -s $MAIL_SMTP $userparam $passparam
|
---|
| 35 | fi
|
---|
| 36 | fi
|
---|
Note:
See
TracBrowser
for help on using the repository browser.