Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- scripts_to_run=/home/cst334/HW6/
- WAITING=0
- AVG_WAIT=0
- COUNTER=0
- echo 'Before:'
- for Job in "$scripts_to_run"*
- do
- if [[ -x "$Job" ]]; then
- STARTTIME=$(date +%s)
- "$Job"
- ENDTIME=$(date +%s)
- BURST=$(($ENDTIME - $STARTTIME))
- echo "Burst Time: $BURST seconds... Waiting time: $WAITING"
- AVG_WAIT=$((AVG_WAIT + $WAITING))
- WAITING=$(($WAITING + $BURST))
- COUNTER=$(($COUNTER + 1))
- fi
- done
- echo "Average Waiting is: $(($AVG_WAIT / $COUNTER))"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement