Skip to content

Instantly share code, notes, and snippets.

@ke4roh
Created June 24, 2015 14:43
Show Gist options
  • Save ke4roh/dcdcb27f5cf23eb90dba to your computer and use it in GitHub Desktop.
Save ke4roh/dcdcb27f5cf23eb90dba to your computer and use it in GitHub Desktop.
perform kinit if there is no kerberos ticket
#!/bin/bash
while ! klist -s ; do
ERR=$( kinit 3>&2 2>&1 1>&3- )
EC=$?
if [ $EC -ne 0 ] ; then
echo $ERR
if ( echo $ERR | grep -q "Cannot contact any KDC" ) ; then
exit 2
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment