Annotation of dgamelaunch-openbsd/stresstest_create.sh, Revision 1.1
1.1 ! rubenllo 1: #!/bin/sh
! 2: # stress-test script for creation of new accounts
! 3: # current directory must contain the dgamelaunch to be used
! 4: # this thing eats pseudo-terminals like hell!
! 5:
! 6: # Be sure to change these variables
! 7: conffile="test2.conf"
! 8: chrootdir="chroot-2"
! 9: hackdir="/usr/local/lib/nethack"
! 10: nameprefix="testcreat"
! 11: jailuser="dgl"
! 12: jailgroup="dgl"
! 13: max=40
! 14:
! 15: # clean up previous cruft
! 16: #rm -f "$chrootdir"/dgldir/inprogress/*
! 17: #rm -f "$chrootdir$hackdir"/save/*[0-9]test[0-9]*
! 18:
! 19: echo -n "Starting processes:"
! 20: export conffile i nameprefix delay1 delay2 email
! 21: i=1
! 22: pidlist=''
! 23: while [ $i -le $max ]; do
! 24: email="$nameprefix$i@nowhere.nowhere"
! 25: case "$i" in
! 26: *[125]) delay1=0.1 delay2=0.1 ;;
! 27: *[368]) delay1=0.1 delay2=0.1 ;;
! 28: *[470]) delay1=0.1 delay2=0.1 ;;
! 29: *9) delay1=0.1 delay2=0.1 email='' ;;
! 30: esac
! 31: xterm -e sh -c '{ sleep 1; echo "r$nameprefix$i"; echo aa; echo aa; sleep $delay1; echo "$email"; sleep $delay2; echo -n py i; cat; } | { ./dgamelaunch -f "$conffile"; echo $?; } '&
! 32: echo -n " $!"
! 33: pidlist="$pidlist $!"
! 34: [ $i = 5 ] && sleep 0.1
! 35: [ $i = 15 ] && sleep 0.3
! 36: [ $i = 25 ] && sleep 1
! 37: [ $i = 31 ] && sleep 4
! 38: i=$(($i+1))
! 39: done
! 40: echo
! 41: sleep 10
! 42: nums=$(sed -n -e "s/^$nameprefix\([0-9]*\):.*:.*:.*/\1/p" $chrootdir/dgl-login |
! 43: sort -n | xargs)
! 44: allnums=$(jot $max | grep -v 9\$ | xargs)
! 45: if [ "$nums" = "$allnums" ]; then
! 46: echo "Complete list"
! 47: rc=0
! 48: else
! 49: echo "ERROR: Incomplete list!"
! 50: echo "$nums"
! 51: rc=1
! 52: fi
! 53: sed -e "/^$nameprefix\([0-9]*\):.*:.*:.*/d" $chrootdir/dgl-login > $chrootdir/dgl-login.new
! 54: mv $chrootdir/dgl-login.new $chrootdir/dgl-login
! 55: chown $jailuser:$jailgroup $chrootdir/dgl-login
! 56: echo -n "Press return to remove all xterms: "
! 57: read x
! 58: kill $pidlist 2>/dev/null
! 59: exit $rc
CVSweb