add check writable
This commit is contained in:
parent
871cdbda13
commit
406086a119
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if argument is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No arguments provided"
|
||||
echo "./check_writable.sh [path to directory to test]"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Check if directory exists
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "UNKNOWN - $1 is not a directory"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Check if directory is not writable
|
||||
if [ ! -w "$1" ]; then
|
||||
echo "OK - $1 is not writable"
|
||||
exit 0
|
||||
else
|
||||
echo "CRITICAL - $1 is writable"
|
||||
exit 2
|
||||
fi
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if argument is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No arguments provided"
|
||||
echo "./check_writable.sh [path to directory to test]"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Check if directory exists
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "UNKNOWN - $1 is not a directory"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Check if directory is writable
|
||||
if [ -w "$1" ]; then
|
||||
echo "OK - $1 is writable"
|
||||
exit 0
|
||||
else
|
||||
echo "CRITICAL - $1 is not writable"
|
||||
exit 2
|
||||
fi
|
Loading…
Reference in New Issue