#!/bin/bash #config section filename="deleteme.dd" logfile="connection_test.log" size="10" #MB #size=$2 #connection_string="david@dooku.aec.at" connection_string=$1 #functions timestamp() { date "+%c" } #script start echo "[$(timestamp)] - generationg local temp file ($filename)" #appending a "k" to $size size=$(echo $size"k") dd if=/dev/zero of=/tmp/$filename bs=1024 count=$size &> $logfile echo "[$(timestamp)] - starting upload test" scp -v /tmp/$filename $connection_string:/tmp/$filename &> $logfile Bps=$(cat deleteme.log | grep "Bytes per second" | awk '{print $5}') count=${#Bps}; count=$((count-1)); Bps=${Bps:0:$count} echo "[$(timestamp)] - upload speed: $Bps Bytes/s" #clean up echo "[$(timestamp)] - removing temp files" rm /tmp/$filename rm $logfile exit 0 #end of script