summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/backend_control.sh
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-09-21 15:12:58 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-09-21 15:12:58 (GMT)
commite235a08c001227e1258b4c23b1c1e9bbe63d3256 (patch)
treec8335ebbec6f4cd5959503fc0975b012a95148dd /abs/core/LinHES-config/backend_control.sh
parent397663589accedf4566712eb371ab3bb21f33d67 (diff)
downloadlinhes_pkgbuild-e235a08c001227e1258b4c23b1c1e9bbe63d3256.zip
linhes_pkgbuild-e235a08c001227e1258b4c23b1c1e9bbe63d3256.tar.gz
linhes_pkgbuild-e235a08c001227e1258b4c23b1c1e9bbe63d3256.tar.bz2
LinHES-config: backend_control.sh add the ability to detect if func failed and attempt to display the msg using local msg_client.py
Diffstat (limited to 'abs/core/LinHES-config/backend_control.sh')
-rwxr-xr-xabs/core/LinHES-config/backend_control.sh66
1 files changed, 44 insertions, 22 deletions
diff --git a/abs/core/LinHES-config/backend_control.sh b/abs/core/LinHES-config/backend_control.sh
index 24c6551..07ff162 100755
--- a/abs/core/LinHES-config/backend_control.sh
+++ b/abs/core/LinHES-config/backend_control.sh
@@ -6,39 +6,61 @@ COMMAND=$1
BETYPE=$2
eval LAST=\$$#
dbhost=`echo $LAST`
-
-
+hostname=`hostname`
MESSAGE=""
+
case $COMMAND in
- stop) MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestop.cgi 2>/dev/null`
+ stop) MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestop.cgi 2>/dev/null`
rc=$?
+
if [ $rc != 0 ]
then
lh_message.sh "Could not stop the backend."
+ else
+ echo "$MESSAGE" | grep -q "'$hostname': 'Message delivered'"
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ msg_client.py "* Backend Stopped" > /dev/null
+ fi
fi
- ;;
+ ;;
- start )
- MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestart.cgi 2>/dev/null`
- rc=$?
- if [ $rc != 0 ]
- then
+ start )
+ MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestart.cgi 2>/dev/null`
+ rc=$?
+ if [ $rc != 0 ]
+ then
lh_message.sh "Could not start the backend"
- fi
- ;;
+ else
+ echo "$MESSAGE" | grep -q "'$hostname': 'Message delivered'"
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ msg_client.py "* Backend Started" > /dev/null
+ fi
+ fi
+ ;;
- restart)
- /usr/MythVantage/bin/backend_control.sh stop $dbhost
- sleep 2
- /usr/MythVantage/bin/backend_control.sh start $dbhost
+ restart)
+ /usr/MythVantage/bin/backend_control.sh stop $dbhost
+ sleep 2
+ /usr/MythVantage/bin/backend_control.sh start $dbhost
+ ;;
- ;;
- clearcache)
- MESSAGE2=`/usr/bin/curl http://$dbhost:1337/beclear.cgi 2>/dev/null`
- rc=$?
- if [ $rc != 0 ]
- then
+ clearcache)
+ MESSAGE2=`/usr/bin/curl http://$dbhost:1337/beclear.cgi 2>/dev/null`
+ rc=$?
+ if [ $rc != 0 ]
+ then
lh_message.sh "Could not clear the cache"
- fi
+ else
+ echo "$MESSAGE" | grep -q "'$hostname': 'Message delivered'"
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ msg_client.py "* cache cleared" > /dev/null
+ fi
+ fi
esac