#!/bin/sh # # curl -c /tmp/cookie.txt --location -k "https://oampfsqual.princeton.edu:443/psp/pfsqual/EMPLOYEE/ERP/" | grep "Central Authentication Service" http="http" uri="" search="" host="" while [ -n "$1" ]; do case "$1" in -S) http="https"; shift 1;; -H) host="$2"; shift 2;; -u) uri="$2"; shift 2;; -s) search="$2"; shift 2;; *) shift 1;; esac done tmpfile="/tmp/cookies.txt.$$" rm -Rf $tmpfile curl --silent -c $tmpfile --location -k "$http://$host$uri" > $tmpfile.output [ $? -ne 0 ] && echo "WARNING: $http://$host$uri did not respond properly" && exit 1 if [ -n "$search" ]; then grep -q "$search" $tmpfile.output [ $? -ne 0 ] && echo "CRITICAL: Cannot find $search in $http://$host$uri" && exit 2 echo "OK: Found $search in $http://$host$uri" fi exit 0