Skip to content

Instantly share code, notes, and snippets.

@saml
Created March 6, 2013 16:04
Show Gist options
  • Save saml/5100383 to your computer and use it in GitHub Desktop.
Save saml/5100383 to your computer and use it in GitHub Desktop.
upload file to sling
#!/bin/bash
if (( $# < 2 ))
then
echo "Usage: <watchdir> <targethost:port/dir> [username:password]"
echo "example, $0 myapp localhost:8080/apps"
exit 1
fi
watchdir="$1"
targeturl="$2"
cred="${3:-admin:admin}"
while true
do
x="$(inotifywait -e modify -e move_self --format "%w" "$watchdir"/*)";
curl -u "$cred" -T "$x" "$targeturl/$x";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment