Advertisement
Guest User

Untitled

a guest
Oct 7th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. set -x
  5.  
  6. APPLICATION_NAME="memcachestream"
  7. WOWZA_IP="172.30.0.175"
  8. RESTAPI_PORT="8087"
  9. USER="admin"
  10. PASS="a"
  11.  
  12. 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"
  13. 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"
  14.  
  15.  
  16. APPEXIST=`$CURRENT |/bin/grep $APPLICATION_NAME |/usr/bin/cut -f2 -d">" |/usr/bin/cut -f1 -d"<"`
  17. WURKTIME=`$CURRENT |/bin/grep "Uptime" |/usr/bin/cut -f2 -d">" |/usr/bin/cut -f1 -d"<"`
  18. TOTALCON=`$CURRENT |/bin/grep "TotalConnections" |/usr/bin/cut -f2 -d">" |/usr/bin/cut -f1 -d"<"`
  19.  
  20.  
  21. if [[ $APPEXIST = $APPLICATION_NAME ]]
  22. then
  23. #echo "OKE!"
  24. if [[ $WURKTIME -gt 0 ]]
  25. then
  26. #echo "nagyobb nulla"
  27. if [[ $TOTALCON -gt 0 ]]
  28. then
  29. #exit 0
  30. /bin/echo " "
  31. else
  32. $APPRESS > /dev/null 2>&1
  33. fi
  34.  
  35. else
  36. #exit 0
  37. /bin/echo " "
  38. fi
  39.  
  40. else
  41. #exit 0
  42. /bin/echo " "
  43. fi
  44.  
  45. #sleep 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement