launchall.sh 648 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. function finish {
  3. echo "Exiting"
  4. echo '{"type": "snowmix", "command": "kill", "key": "video"}' | wscat
  5. echo '{"type": "snowmix", "command": "kill", "key": "audio"}' | wscat
  6. echo '{"type": "snowmix", "command": "kill", "key": "rtmp"}' | wscat
  7. }
  8. snowmix=$(ps axco command | grep -c snowmix)
  9. if [ $snowmix -ne 1 ]; then
  10. echo "snowmix not running!"
  11. exit 1
  12. fi
  13. trap finish EXIT
  14. echo "Running"
  15. echo '{"type": "snowmix", "command": "launch", "key": "video"}' | wscat
  16. echo '{"type": "snowmix", "command": "launch", "key": "audio"}' | wscat
  17. echo '{"type": "snowmix", "command": "launch", "key": "rtmp"}' | wscat
  18. sleep infinity
  19. finish