Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -x
- APPLICATION_NAME="memcachestream"
- WOWZA_IP="172.30.0.175"
- RESTAPI_PORT="8087"
- USER="admin"
- PASS="a"
- CURRENT="/usr/bin/curl --silent --digest -u "$USER:$PASS" -X GET --header 'Accept:application/json; charset=utf-8' http://$WOWZA_IP:$RESTAPI_PORT/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/$APPLICATION_NAME/monitoring/current"
- APPRESS="/usr/bin/curl --silent --digest -u "$USER:$PASS" -X PUT --header 'Accept:application/json; charset=utf-8' http://$WOWZA_IP:$RESTAPI_PORT/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/$APPLICATION_NAME/actions/restart"
- APPEXIST=`$CURRENT |/bin/grep $APPLICATION_NAME |/usr/bin/cut -f2 -d">" |/usr/bin/cut -f1 -d"<"`
- WURKTIME=`$CURRENT |/bin/grep "Uptime" |/usr/bin/cut -f2 -d">" |/usr/bin/cut -f1 -d"<"`
- TOTALCON=`$CURRENT |/bin/grep "TotalConnections" |/usr/bin/cut -f2 -d">" |/usr/bin/cut -f1 -d"<"`
- if [[ $APPEXIST = $APPLICATION_NAME ]]
- then
- #echo "OKE!"
- if [[ $WURKTIME -gt 0 ]]
- then
- #echo "nagyobb nulla"
- if [[ $TOTALCON -gt 0 ]]
- then
- #exit 0
- /bin/echo " "
- else
- $APPRESS > /dev/null 2>&1
- fi
- else
- #exit 0
- /bin/echo " "
- fi
- else
- #exit 0
- /bin/echo " "
- fi
- #sleep 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement