|
202 | 202 | if [ "$OMV_VERSION" -ge 7 ]; then |
203 | 203 | pick_snapraid_conf_file |
204 | 204 | else |
205 | | - echo "SnapRAID configuration file not found. The script cannot be run! Please check your settings, because the specified file "$SNAPRAID_CONF" does not exist." |
206 | | - 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." |
| 205 | + echo "SnapRAID configuration file not found. The script cannot be run! Please check your settings, because the specified file \"$SNAPRAID_CONF\" does not exist." |
| 206 | + 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." |
207 | 207 | SUBJECT="[WARNING] - SnapRAID configuration file not found!" |
208 | 208 | FORMATTED_CONF="\`$SNAPRAID_CONF\`" |
209 | 209 | NOTIFY_OUTPUT="$SUBJECT The script cannot be run! Please check your settings, because the specified file $FORMATTED_CONF does not exist." |
|
465 | 465 | # Save and rotate logs if enabled |
466 | 466 | if [ "$RETENTION_DAYS" -gt 0 ]; then |
467 | 467 | find "$SNAPRAID_LOG_DIR"/SnapRAID-* -mtime +"$RETENTION_DAYS" -delete # delete old logs |
468 | | - cp $TMP_OUTPUT "$SNAPRAID_LOG_DIR"/SnapRAID-"$(date +"%Y_%m_%d-%H%M")".txt |
| 468 | + cp "$TMP_OUTPUT" "$SNAPRAID_LOG_DIR"/SnapRAID-"$(date +"%Y_%m_%d-%H%M")".txt |
469 | 469 | fi |
470 | 470 |
|
471 | 471 | # exit with success, letting the trap handle cleanup of file descriptors |
@@ -557,6 +557,7 @@ sed_me(){ |
557 | 557 | # process and redirect output. We close stream because of the calls to new |
558 | 558 | # wait function in between sed_me calls. If we do not do this we try to close |
559 | 559 | # Processes which are not parents of the shell. |
| 560 | + # shellcheck disable=SC2261 |
560 | 561 | exec >& "$OUT" 2>& "$ERROR" |
561 | 562 | sed -i "$1" "$2" |
562 | 563 |
|
@@ -676,7 +677,7 @@ chk_sync_warn(){ |
676 | 677 | chk_zero(){ |
677 | 678 | echo "### SnapRAID TOUCH [$(date)]" |
678 | 679 | echo "Checking for zero sub-second files..." |
679 | | - TIMESTATUS=$($SNAPRAID_BIN -c $SNAPRAID_CONF status | grep -E 'You have [1-9][0-9]* files with( a)? zero sub-second timestamp\.' | sed 's/^You have/Found/g') |
| 680 | + TIMESTATUS=$($SNAPRAID_BIN -c "$SNAPRAID_CONF" status | grep -E 'You have [1-9][0-9]* files with( a)? zero sub-second timestamp\.' | sed 's/^You have/Found/g') |
680 | 681 | if [ -n "$TIMESTATUS" ]; then |
681 | 682 | echo "$TIMESTATUS" |
682 | 683 | echo "Running TOUCH job to timestamp. [$(date)]" |
@@ -970,7 +971,7 @@ if [ "$APPRISE" -eq 1 ]; then |
970 | 971 | APPRISE_EMAIL_ATTACH_DO=0 |
971 | 972 | fi |
972 | 973 |
|
973 | | - mklog "INFO: "$SUBJECT"" |
| 974 | + mklog "INFO: $SUBJECT" |
974 | 975 | } |
975 | 976 |
|
976 | 977 | notify_warning(){ |
@@ -1023,6 +1024,7 @@ if [ "$APPRISE_EMAIL" -eq 1 ]; then |
1023 | 1024 |
|
1024 | 1025 |
|
1025 | 1026 | show_snapraid_info() { |
| 1027 | + # shellcheck disable=SC2155 |
1026 | 1028 | local command_output=$($1) |
1027 | 1029 | echo "$2" |
1028 | 1030 | echo "\`\`\`" |
|
1168 | 1170 | # finish. Probably not the best way of 'fixing' this issue. Someone with more |
1169 | 1171 | # knowledge can provide better insight. |
1170 | 1172 | close_output_and_wait(){ |
| 1173 | + # shellcheck disable=SC2261 |
1171 | 1174 | exec >& "$OUT" 2>& "$ERROR" |
1172 | 1175 | CHILD_PID=$(pgrep -P $$) |
1173 | 1176 | if [ -n "$CHILD_PID" ]; then |
@@ -1426,7 +1429,8 @@ extract_snapraid_info() { |
1426 | 1429 | # Run SnapRAID status to check for the previous sync |
1427 | 1430 | check_snapraid_status() { |
1428 | 1431 | # Run snapraid status command and capture the output |
1429 | | - local snapraid_status_output=$("$SNAPRAID_BIN" status -c "$SNAPRAID_CONF") |
| 1432 | + local snapraid_status_output |
| 1433 | + snapraid_status_output=$("$SNAPRAID_BIN" status -c "$SNAPRAID_CONF") |
1430 | 1434 |
|
1431 | 1435 | # Check for the "No sync is in progress" message |
1432 | 1436 | if echo "$snapraid_status_output" | grep -q "No sync is in progress"; then |
|
0 commit comments