Created
December 23, 2012 06:33
-
-
Save zxjinn/4362311 to your computer and use it in GitHub Desktop.
Simple read/write to ensure the file system is writeable. File to read/write is currently fixed, but contents are dynamic (uses $RANDOM). Designed to be used with Nagios.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RANDOMFILE="/tmp/${RANDOM}-${RANDOM}-${RANDOM}.txt" | |
RANDOMCONTENTS="${RANDOM}${RANDOM}${RANDOM}" | |
export $SUVVESS="3" | |
function writeit() | |
{ | |
touch $RANDOMFILE | |
echo -n $RANDOMCONTENTS > $RANDOMFILE | |
RETVAL=$? | |
return ${RETVAL} | |
} | |
function readit() | |
{ | |
VALUEREAD=$(cat $RANDOMFILE) | |
if [ $VALUEREAD -eq $RANDOMCONTENTS ]; then | |
export SUVVESS="0" | |
else | |
export SUVVESS="1" | |
fi | |
return $SUVVESS | |
} | |
function deleteit() | |
{ | |
rm $RANDOMFILE | |
} | |
writeit | |
readit | |
deleteit | |
exit $SUVVESS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment