Skip to content

Instantly share code, notes, and snippets.

@saml
Created September 14, 2011 20:47
Show Gist options
  • Select an option

  • Save saml/1217743 to your computer and use it in GitHub Desktop.

Select an option

Save saml/1217743 to your computer and use it in GitHub Desktop.
#!/bin/bash
if (( $# < 1))
then
echo "Usage: $0 host:port"
echo "example"
echo " $0 localhost:4502 < admin-password.txt"
exit 1
fi
h="$1"
user="admin"
workspace="crx.default"
read -s -p "password for admin> " password
cookie=$(tempfile --suffix=".cookie")
echo "logging in to $workspace as $user"
curl -f -s -c "$cookie" \
-F"_charset_=UTF-8" \
-F"UserId=$user" \
-F"Password=$password" \
-F"Workspace=$workspace" "http://$h/crx/login.jsp" &&
echo "got cookie: $cookie" &&
curl -f -s -b "$cookie" \
-F"memGc=checked" \
-F"delete=checked" \
-F"pmScan=checked" \
-F"sleep=10" \
-F"action=run" "http://$h/crx/config/datastore_gc.jsp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment