Skip to content

Instantly share code, notes, and snippets.

@SergeStinckwich
Created June 7, 2012 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save SergeStinckwich/2887028 to your computer and use it in GitHub Desktop.
Save SergeStinckwich/2887028 to your computer and use it in GitHub Desktop.
Send a file to dl.free.fr from travis-ci
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: $0 <file>"
exit 1
fi
name=test$RANDOM@test$RANDOM.fr
pass=$RANDOM
file="$1"
out=$(mktemp)
#tail -f $out &
#tailpid=$!
ftp -pinv > $out << EOF
open dl.free.fr
user $name $pass
bin
put "$file" "$(basename $file)"
close
bye
EOF
#kill $tailpid
url=$(grep -E '226-' $out | grep -Eo 'http://dl.free.fr/[^ ]+')
if [ -n "$url" ]; then
echo "-- SUCCESS --"
echo " url: $url "
else
echo "-- ERROR --"
cat $out
fi
rm $out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment