Tobias Brunner b3a72c7994 testing: Use an on-guest script to cleanup/initialize and run them in parallel
This is a bit quicker than doing this with separate SSH calls for each
host sequentially (up to half a second per test).
2024-12-03 08:43:45 +01:00

39 lines
636 B
Bash
Executable File

#! /bin/bash
while getopts "i:d:" opt
do
case "$opt" in
i)
INTERFACE=${OPTARG}
;;
d)
DB=${OPTARG}
esac
done
shift $((OPTIND-1))
# start tcpdump in the background
if [ -n "$INTERFACE" ]
then
tcpdump -l --immediate-mode -i $INTERFACE not port ssh and not port domain >/tmp/tcpdump.log 2>/tmp/tcpdump.err.log &
fi
# setup ramdisk for databases
if [ -n "$DB" ]
then
mkdir -p $DB
mount -t ramfs -o size=5m ramfs $DB
chgrp www-data $DB
chmod g+w $DB
fi
# flush conntrack table
conntrack -F >/dev/null 2>&1
# flush IPsec state
ip xfrm state flush
ip xfrm policy flush
# remove leak detective log
rm -f $LEAK_DETECTIVE_LOG