You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# if running on OMV7, try to find the SnapRAID conf file automatically
139
133
check_omv_version
140
-
if [ "$OMV_VERSION"-ge 7 ];then
141
-
pick_snapraid_conf_file
142
-
else
143
-
echo"SnapRAID configuration file not found. The script cannot be run! Please check your settings, because the specified file "$SNAPRAID_CONF" does not exist."
144
-
mklog "WARN: SnapRAID configuration file not found. The script cannot be run! Please check your settings, because the specified file "$SNAPRAID_CONF" does not exist."
145
-
SUBJECT="[WARNING] - SnapRAID configuration file not found!"
146
-
FORMATTED_CONF="\`$SNAPRAID_CONF\`"
147
-
NOTIFY_OUTPUT="$SUBJECT The script cannot be run! Please check your settings, because the specified file $FORMATTED_CONF does not exist."
148
-
notify_warning
149
-
if [ "$EMAIL_ADDRESS" ];then
150
-
trim_log <"$TMP_OUTPUT"| send_mail
151
-
fi
152
-
exit 1;
153
-
fi
134
+
if [ "$OMV_VERSION"-ge 7 ];then
135
+
pick_snapraid_conf_file
136
+
else
137
+
echo"SnapRAID configuration file not found. The script cannot be run! Please check your settings, because the specified file "$SNAPRAID_CONF" does not exist."
138
+
mklog "WARN: SnapRAID configuration file not found. The script cannot be run! Please check your settings, because the specified file "$SNAPRAID_CONF" does not exist."
139
+
SUBJECT="[WARNING] - SnapRAID configuration file not found!"
140
+
FORMATTED_CONF="\`$SNAPRAID_CONF\`"
141
+
NOTIFY_OUTPUT="$SUBJECT The script cannot be run! Please check your settings, because the specified file $FORMATTED_CONF does not exist."
142
+
notify_warning
143
+
fi
154
144
fi
155
145
156
146
@@ -234,9 +224,6 @@ function main(){
234
224
SUBJECT="[WARNING] - Unable to continue with SYNC/SCRUB job(s). Check DIFF job output. $EMAIL_SUBJECT_PREFIX"
235
225
NOTIFY_OUTPUT="$SUBJECT"
236
226
notify_warning
237
-
if [ "$EMAIL_ADDRESS" ];then
238
-
trim_log <"$TMP_OUTPUT"| send_mail
239
-
fi
240
227
exit 1;
241
228
fi
242
229
if [ $IGNORE_PATTERN ];then
@@ -352,6 +339,12 @@ if [ "$SNAP_STATUS" -eq 1 ]; then
352
339
fi
353
340
fi
354
341
342
+
# Custom Hook - After (if executed before drive spin down)
343
+
if [ "$CUSTOM_HOOK"-eq 1 ] && [ "$EXECUTE_BEFORE_SPINDOWN"-eq 1 ];then
344
+
echo"### Custom Hook - [$AFTER_HOOK_NAME]";
345
+
bash -c "$AFTER_HOOK_CMD"
346
+
fi
347
+
355
348
# Spin down disks (Method hd-idle - spins down all rotational devices)
356
349
# NOTE: Uses hd-idle rewrite
357
350
@@ -373,7 +366,7 @@ fi
373
366
fi
374
367
375
368
# Custom Hook - After
376
-
if [ "$CUSTOM_HOOK"-eq 1 ];then
369
+
if [ "$CUSTOM_HOOK"-eq 1 ]&& [ "$EXECUTE_BEFORE_SPINDOWN"-ne 1 ];then
377
370
echo"### Custom Hook - [$AFTER_HOOK_NAME]";
378
371
bash -c "$AFTER_HOOK_CMD"
379
372
fi
@@ -431,9 +424,6 @@ function sanity_check() {
431
424
SUBJECT="[WARNING] - Parity file ($i) not found! $EMAIL_SUBJECT_PREFIX"
432
425
NOTIFY_OUTPUT="$SUBJECT"
433
426
notify_warning
434
-
if [ "$EMAIL_ADDRESS" ];then
435
-
trim_log <"$TMP_OUTPUT"| send_mail
436
-
fi
437
427
exit 1;
438
428
fi
439
429
done
@@ -452,9 +442,6 @@ function sanity_check() {
452
442
SUBJECT="[WARNING] - Content file ($i) not found! $EMAIL_SUBJECT_PREFIX"
453
443
NOTIFY_OUTPUT="$SUBJECT"
454
444
notify_warning
455
-
if [ "$EMAIL_ADDRESS" ];then
456
-
trim_log <"$TMP_OUTPUT"| send_mail
457
-
fi
458
445
exit 1;
459
446
fi
460
447
done
@@ -910,6 +897,9 @@ function notify_warning(){
910
897
-d '{"content": "'"$DISCORD_SUBJECT"'"}' \
911
898
"$DISCORD_WEBHOOK_URL"
912
899
fi
900
+
if [ "$EMAIL_ADDRESS" ];then
901
+
trim_log <"$TMP_OUTPUT"| send_mail
902
+
fi
913
903
}
914
904
915
905
functionshow_snapraid_info() {
@@ -971,28 +961,39 @@ function send_mail(){
971
961
python3 -m markdown |
972
962
sed 's/<code>/<pre>/;s%</code>%</pre>%')
973
963
974
-
if [ -x"$HOOK_NOTIFICATION" ];then
975
-
echo -e "Notification user script is set. Calling it now [$(date)]"
976
-
$HOOK_NOTIFICATION"$SUBJECT""$body"
977
-
elif [ "$EMAIL_ADDRESS" ];then
978
-
echo -e "Email address is set. Sending email report to **$EMAIL_ADDRESS** [$(date)]"
979
-
if [ -z"$MAIL_BIN" ];then
980
-
echo -e "No mail program set in MAIL_BIN, you must set it to send email."
NOTIFY_OUTPUT="$SUBJECT Stopping the script due to multiple SnapRAID configuration files. Please choose one config file and update your settings in the script-config file at ""$CONFIG_FILE""."
1089
1090
notify_warning
1090
-
if [ "$EMAIL_ADDRESS" ];then
1091
-
trim_log <"$TMP_OUTPUT"| send_mail
1092
-
fi
1093
1091
exit 1;
1094
1092
1095
1093
else
@@ -1100,9 +1098,6 @@ else
1100
1098
FORMATTED_CONF="\`$SNAPRAID_CONF\`"
1101
1099
NOTIFY_OUTPUT="$SUBJECT The script cannot be run! Please check your settings, because the specified file $FORMATTED_CONF does not exist."
0 commit comments