Skip to content

Commit 14ee372

Browse files
authored
snapraid binary check
Check if the SnapRAID binary was found. If not, it will error out.
1 parent 51cfba6 commit 14ee372

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

snapraid-aio-script.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
######################
99
# SCRIPT VARIABLES #
1010
######################
11-
SNAPSCRIPTVERSION="3.4" #DEV2
11+
SNAPSCRIPTVERSION="3.4" #DEV3
1212

1313
# Read SnapRAID version
1414
SNAPRAIDVERSION="$(snapraid -V | sed -e 's/snapraid v\(.*\)by.*/\1/')"
@@ -97,6 +97,16 @@ function main(){
9797
fi
9898
fi
9999

100+
### Check if SnapRAID is found
101+
if [ -z "$SNAPRAID_BIN" ]; then
102+
echo "**ERROR**: SnapRAID binary not found in PATH. Please check if SnapRAID is installed correctly and found in the PATH environment values of your system."
103+
mklog "WARN: SnapRAID binary not found in PATH. Please check if SnapRAID is installed correctly and found in the PATH environment values of your system."
104+
SUBJECT="[WARNING] - SnapRAID binary not found in PATH $EMAIL_SUBJECT_PREFIX"
105+
NOTIFY_OUTPUT="$SUBJECT"
106+
notify_warning
107+
exit 1
108+
fi
109+
100110
### Check if SnapRAID is already running
101111
if pgrep -x snapraid >/dev/null; then
102112
echo "The script has detected SnapRAID is already running. Please check the status of the previous SnapRAID job before running this script again."

0 commit comments

Comments
 (0)