Skip to content

Commit

Permalink
run-workload move trap commands into function
Browse files Browse the repository at this point in the history
This hopefully will make it easier to maintain.
  • Loading branch information
markwkm committed Apr 25, 2023
1 parent fe61c8b commit a6de000
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/scripts/dbt2-run-workload
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
# Copyright The DBT-2 Authors
#

trap 'echo "Test was interrupted by Control-C."; \
killall dbt2-client dbt2-driver sar sadc pidstat; dbt2-${DBMS}-stop-db; killall dbt2-${DBMS}-db-stat sar sadc pidstat' INT
trap 'echo "Test was interrupted. Got TERM signal."; \
killall dbt2-client dbt2-driver sar sadc pidstat; dbt2-${DBMS}-stop-db; killall dbt2-${DBMS}-db-stat sar sadc pidstat' TERM

do_sleep()
{
echo "Sleeping $1 seconds"
Expand Down Expand Up @@ -314,6 +309,15 @@ readprofile_clear()
${COMMAND} sudo /usr/sbin/readprofile -r
}

stop_processes() {
killall dbt2-client dbt2-driver sar sadc pidstat
"dbt2-${DBMS}-stop-db"
killall "dbt2-${DBMS}-db-stat" sar sadc pidstat
}

trap 'echo "Test was interrupted by Control-C."; stop_processes' INT
trap 'echo "Test was interrupted. Got TERM signal."; stop_processes' TERM

usage()
{
if [ "$1" != "" ]; then
Expand Down

0 comments on commit a6de000

Please sign in to comment.