repeat.sh 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/sh
  2. interval=15
  3. cs_out=cimserver.out
  4. cs_err=cimserver.err
  5. to_collect="$cs_out $cs_err listener.out"
  6. default_out=out
  7. installdir=$(dirname $0)
  8. ##
  9. cim_start() {
  10. cimserver "daemon=false" "forceProviderProcesses=false" \
  11. >$cs_out \
  12. 2>$cs_err \
  13. &
  14. }
  15. cim_stop() {
  16. killall cimserver
  17. }
  18. ## The Git Monitor
  19. tgm_init() {
  20. echo Initializing TGM
  21. yum -y -q install git &>/dev/null
  22. pushd $out
  23. git init
  24. echo The Git Monitor > README
  25. git add README
  26. git commit -qm "Initial commit"
  27. popd
  28. }
  29. tgm_add() {
  30. pushd $out
  31. git add .
  32. git commit -qm "Regular commit"
  33. popd
  34. }
  35. ##
  36. test_prepare() {
  37. true
  38. mkdir -p $out
  39. cim_start
  40. $installdir/subscribe.py
  41. tgm_init
  42. }
  43. test_setup() {
  44. true
  45. }
  46. test_run() {
  47. $installdir/trigger.sh -N -o $out -u joe
  48. }
  49. test_collect() {
  50. cp $to_collect $out
  51. tgm_add
  52. }
  53. test_teardown() {
  54. true
  55. }
  56. test_cleanup() {
  57. true
  58. cim_stop
  59. }
  60. ##
  61. stamp() {
  62. date +%Y%m%d-%H%M%S
  63. }
  64. handler_stop() {
  65. go_on=false
  66. }
  67. trap handler_stop SIGINT
  68. out=$default_out
  69. test_prepare
  70. go_on=true
  71. while $go_on;
  72. do
  73. echo new round
  74. echo out=$out
  75. test_setup
  76. test_run
  77. test_collect
  78. test_teardown
  79. echo waiting ${interval}s for next round
  80. sleep $interval
  81. done
  82. test_cleanup