svmm 734 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # SVMM event manager
  3. # Chris Dorman (C) 2020
  4. wrkdir=`pwd`
  5. events="svmm_db/events"
  6. pids="svmm_db/pids"
  7. while true
  8. do
  9. cd $wrkdir/$events
  10. for x in *
  11. do
  12. if [ -f "$x" ]; then
  13. execcmd=`cat $x`
  14. rm $x
  15. cd $wrkdir
  16. `$execcmd`
  17. cd $events
  18. fi
  19. done
  20. cd $wrkdir/$pids
  21. for y in *
  22. do
  23. if [ -f "$y" ]; then
  24. if ps -p $(cat $y) > /dev/null
  25. then
  26. cd $wrkdir/svmm_db/users
  27. echo "<div style='display:inline;color:#00ff00;'>Running</div>" > $y.status
  28. echo -n "true" > $y.statuscode
  29. else
  30. cd $wrkdir/svmm_db/users
  31. echo "<div style='display:inline;color:#ff0000;'>Stopped</div>" > $y.status
  32. echo -n "false" > $y.statuscode
  33. fi
  34. cd $wrkdir/$pids
  35. fi
  36. done
  37. sleep 5
  38. done