From 351800961eb8d687bca13e9c188d38b65d42df5b Mon Sep 17 00:00:00 2001 From: goldenman-kmd <33863358+goldenman-kmd@users.noreply.github.com> Date: Tue, 1 May 2018 02:54:01 +0900 Subject: [PATCH] Create README.md --- goldenman/komodod-crash-detect/README.md | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 goldenman/komodod-crash-detect/README.md diff --git a/goldenman/komodod-crash-detect/README.md b/goldenman/komodod-crash-detect/README.md new file mode 100644 index 0000000..32b8b3f --- /dev/null +++ b/goldenman/komodod-crash-detect/README.md @@ -0,0 +1,37 @@ +# komodo daemon crash detect and re-run automatically + +### 1. creat shell script in home dir +``` +$ vim check_komodo.sh +``` +``` +#!/bin/bash + +dt=$(date '+%Y/%m/%d_%H:%M:%S'); +psresult=$(ps aux | grep -c "komodod -gen"); +#echo "$dt-$psresult" + +if [ $psresult -eq 2 ] +then +echo "$dt - result = $psresult - Okay" +else +echo "$dt - result = $psresult - NG" +~/start & +echo "$dt - re-run komodo daemon" +fi +``` +This shell will check komodod process is on process list and if not exist, call `~/start` to re-run daemon. + + +### 2. add this script on `crontab` +``` +$ crontab -e +``` +And add below at the end of editor +``` +# m h dom mon dow command +*/5 * * * * ~/check_komodo.sh >> ~/check_komodo.log 2>&1 +``` +This will run shell every 5 minute. You can edit interval to check daemon crash. + +