Skip to content

Instantly share code, notes, and snippets.

@charlesfg
Created November 27, 2013 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesfg/7682961 to your computer and use it in GitHub Desktop.
Save charlesfg/7682961 to your computer and use it in GitHub Desktop.
Script para fazer o profile da OpenX
#!/bin/bash
#
# Elapsed time. Usage:
#
# t=$(timer)
# ... # do something
# printf 'Elapsed time: %s\n' $(timer $t)
# ===> Elapsed time: 0:01:12
#
#
#####################################################################
# If called with no arguments a new timer is returned.
# If called with arguments the first is used as a timer
# value and the elapsed time is returned in the form HH:MM:SS.
#
function timer()
{
if [[ $# -eq 0 ]]; then
echo $(date '+%s')
else
local stime=$1
etime=$(date '+%s')
if [[ -z "$stime" ]]; then stime=$etime; fi
dt=$((etime - stime))
ds=$((dt % 60))
dm=$(((dt / 60) % 60))
dh=$((dt / 3600))
printf '%d:%02d:%02d' $dh $dm $ds
fi
}
# If invoked directly run test code.
if [[ $(basename $0 .sh) == 'timer' ]]; then
t=$(timer)
read -p 'Enter when ready...' p
printf 'Elapsed time: %s\n' $(timer $t)
fi
## vim: tabstop=4: shiftwidth=4: noexpandtab:
## kate: tab-width 4; indent-width 4; replace-tabs false;
while :
do
d=$(date)
t=$(timer)
wget -i urlOpenx_a.txt -q -O /dev/null
echo -n $d
printf "\tOX a\t%s\n" $(timer $t)
sleep 1
d=$(date)
t=$(timer)
wget -i urlOpenx_b.txt -q -O /dev/null
echo -n $d
printf "\tOX b\t%s\n" $(timer $t)
echo "----"
sleep 5
done
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=95509&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=101445&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=101446&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=101447&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512619&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512620&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512621&tid=3
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512622&tid=3
http://ox-d.sambaads.com/v/1.0/av?auid=95505&tid=6
http://ox-d.sambaads.com/v/1.0/av?auid=101905&tid=6
http://ox-d.sambaads.com/v/1.0/av?auid=101906&tid=6
http://ox-d.sambaads.com/v/1.0/av?auid=101907&tid=6
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512571&tid=6
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512572&tid=6
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512573&tid=6
http://ox-d.sambavideos.sambatech.com/v/1.0/av?auid=512574&tid=6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment