Guest User

Untitled

a guest
Nov 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. supervisorctl status | \
  4. awk '
  5. match($0, /^([^:]+):[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).*$/, line) {
  6. SUBSEP=","
  7. # Sadly, we can not initialize all the worker,status couples in the BEGIN section.
  8. # We have to run these almost useless lines during the input parsing
  9. if ( status[line[1],"STOPPED"] == 0 ) { status[line[1],"STOPPED"] = 0 }
  10. if ( status[line[1],"STARTING"] == 0 ) { status[line[1],"STARTING"] = 0 }
  11. if ( status[line[1],"RUNNING"] == 0 ) { status[line[1],"RUNNING"] = 0 }
  12. if ( status[line[1],"BACKOFF"] == 0 ) { status[line[1],"BACKOFF"] = 0 }
  13. if ( status[line[1],"STOPPING"] == 0 ) { status[line[1],"STOPPING"] = 0 }
  14. if ( status[line[1],"EXITED"] == 0 ) { status[line[1],"EXITED"] = 0 }
  15. if ( status[line[1],"FATAL"] == 0 ) { status[line[1],"FATAL"] = 0 }
  16. if ( status[line[1],"UNKNOWN"] == 0 ) { status[line[1],"UNKNOWN"] = 0 }
  17. status[line[1],line[2]]++
  18. }
  19. END {
  20. for(i in status) {
  21. print "- supervisord.workerState[" i "] " status[i]
  22. }
  23. }'
Add Comment
Please, Sign In to add comment