summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlishu <[email protected]>2018-11-29 18:11:33 +0800
committerlishu <[email protected]>2018-11-29 18:11:33 +0800
commitd8a7f80c7553d10cd25db802950a77eddfb586c0 (patch)
tree8b0428e929fe30a995b17855c29f39d5112ac446
parentf50c0f0f61aa3b37c303769590da684cfe9b7b88 (diff)
增加守护
-rw-r--r--bin/kill_rssb_maskey_by_mem.sh17
-rw-r--r--bin/rssb_maskey_r23
-rw-r--r--bin/rssb_maskey_r321
-rw-r--r--bin/shutdown.sh1
4 files changed, 42 insertions, 0 deletions
diff --git a/bin/kill_rssb_maskey_by_mem.sh b/bin/kill_rssb_maskey_by_mem.sh
new file mode 100644
index 0000000..f7c794d
--- /dev/null
+++ b/bin/kill_rssb_maskey_by_mem.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+PROG="rssb_maskey"
+
+while true; do
+ mem_used=`ps -C $PROG u | grep -v RSS | awk '{print $6}'`
+
+ if [ -z $mem_used ]; then
+ mem_used=0
+ elif [ $mem_used -gt 128000000 ]; then
+ killall $PROG;
+ echo "`date` -- $PROG used mem : $mem_used, kill it!" >> kill_by_mem.log
+ fi
+
+ sleep 10
+
+done
diff --git a/bin/rssb_maskey_r2 b/bin/rssb_maskey_r2
new file mode 100644
index 0000000..e4ab87f
--- /dev/null
+++ b/bin/rssb_maskey_r2
@@ -0,0 +1,3 @@
+source /root/.bash_profile
+./rssb_maskey_r3 &> /dev/null &
+./kill_rssb_maskey_by_mem.sh &> /dev/null &
diff --git a/bin/rssb_maskey_r3 b/bin/rssb_maskey_r3
new file mode 100644
index 0000000..0d52871
--- /dev/null
+++ b/bin/rssb_maskey_r3
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+while [ 1 ]; do
+ count=`ls -l core.* |wc -l`
+ echo $count
+ if [ $count -lt 5 ]
+ then
+ echo "set unlimited"
+ ulimit -c unlimited
+ else
+ ulimit -c 0
+ fi
+
+ rssb_num=`ps -ef|grep rssb_maskey$|wc -l`
+ if [ $rssb_num -lt 1 ]
+ then
+ ./rssb_maskey &>/dev/null &
+ echo program crashed, restart at `date +"%w %Y/%m/%d, %H:%M:%S"` >> RESTART.log
+ fi
+ sleep 10
+done
diff --git a/bin/shutdown.sh b/bin/shutdown.sh
new file mode 100644
index 0000000..9c8269d
--- /dev/null
+++ b/bin/shutdown.sh
@@ -0,0 +1 @@
+killall -9 rssb_maskey_r3 rssb_maskey_r2 rssb_maskey kill_rssb_maskey_by_mem.sh