Skip to content

Instantly share code, notes, and snippets.

@jobwat
Created July 16, 2013 01:26
Show Gist options
  • Save jobwat/6005039 to your computer and use it in GitHub Desktop.
Save jobwat/6005039 to your computer and use it in GitHub Desktop.
#!/bin/bash
exit_code=0
tests='
echo -n "MemCache service listening... "; netstat -l | grep "memcache.*LISTEN" > /dev/null 2>&1
echo -n "App returning Set-Cookie: XRSF-TOKEN header... "; curl -I localhost 2>/dev/null | grep "Set-Cookie: XSRF-TOKEN" > /dev/null
echo -n "App /status return 200... "; curl --connect-timeout 1 localhost/status > /dev/null 2>&1
'
IFS=$'\n'
for test in $tests; do
eval $test
sub_code=$?
if [ ${sub_code} -ne 0 ]; then
exit_code=1
echo "FAILED(${sub_code})."
else
echo "Ok."
fi
done
exit $exit_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment