here it is :
#!/bin/sh
GARB=/tmp/garbage
NUMBER=3 # number of files to upload to Safenet
SIZE=1 # size in Mo
PAUSE=1 # pause between each upload in sec
TIMEOUT=$(( $SIZE * 30 )) # 30 sec max / Mo
[ -d $GARB ] || mkdir $GARB
if [ "$1" = "in" ]
then
cd $GARB
COUNTER=1
rm -f list list.md5
until [ $COUNTER -gt $NUMBER ]
do
dd if=/dev/urandom of=./file bs=${SIZE}M count=1 > /dev/null 2>&1
CONT=$(safe files put ./file | tail -c61)
echo "File #${COUNTER} uploaded"
mv file $CONT
echo $CONT >> list
md5sum $CONT >> list.md5
rm -f $CONT
sleep $PAUSE
((COUNTER++))
done
exit 0
fi
if [ "$1" = "out" ]
then
cd $GARB
COUNTER=0
for file in $(cat list)
do
timeout ${TIMEOUT}s safe cat safe://$file > $file
md5sum -c list.md5 --ignore-missing
[ $? -eq 0 ] && ((COUNTER++))
rm -f $file
done
echo "Success : $(( $COUNTER * 100 / $NUMBER )) %"
exit 0
fi
echo "$0 [OPTION]"
echo " in : upload to Safenet"
echo " out : download / test from Safenet"
exit 1