Skip to content

Commit 8cb6aa1

Browse files
author
Oliver Cervera
authored
Improve config detection + snapraid status
- Only use variables when handling config file - Introduce 'snapraid status' but is disabled by default
1 parent b3a8c64 commit 8cb6aa1

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

snapraid-aio-script.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Project page: https://github.com/auanasgheps/snapraid-aio-script
55
#
6-
SNAPSCRIPTVERSION="2.7.0.DEV-5"
6+
SNAPSCRIPTVERSION="2.7.0.DEV-7"
77
########################################################################
88

99
######################
@@ -13,8 +13,9 @@ SNAPSCRIPTVERSION="2.7.0.DEV-5"
1313
# find the current path
1414
CURRENT_DIR="$(dirname "${0}")"
1515

16-
# import the config file for this script which contains all user variables
17-
source $CURRENT_DIR/script-config.sh
16+
# import the config file for this script which contain user configuration
17+
CONFIG_FILE=$CURRENT_DIR/script-config.sh
18+
source $CONFIG_FILE
1819

1920
########################################################################
2021

@@ -44,7 +45,7 @@ function main(){
4445
echo "##Preprocessing"
4546

4647
# Check if script configuration file has been found
47-
if [ ! -f $CURRENT_DIR/config.sh ];
48+
if [ ! -f $CONFIG_FILE ];
4849
then
4950
echo "Script configuration file not found! The script cannot be run! Please check and try again!"
5051
mklog "WARN: Script configuration file not found! The script cannot be run! Please check and try again!"
@@ -190,13 +191,24 @@ function main(){
190191
echo "----------------------------------------"
191192
echo "##Postprocessing"
192193

193-
# Moving onto logging SMART info if enabled
194+
# Show SnapRAID SMART info if enabled
194195
if [ $SMART_LOG -eq 1 ]; then
195196
echo
196197
$SNAPRAID_BIN smart
197198
close_output_and_wait
198199
output_to_file_screen
200+
echo
199201
fi
202+
203+
# Show SnapRAID Status information if enabled
204+
if [ $SNAP_STATUS -eq 1 ]; then
205+
echo
206+
$SNAPRAID_BIN status
207+
close_output_and_wait
208+
output_to_file_screen
209+
echo
210+
fi
211+
200212

201213
# Spinning down disks (Method 1: snapraid - preferred)
202214
if [ $SPINDOWN -eq 1 ]; then
@@ -237,14 +249,14 @@ function main(){
237249
echo
238250
echo "----------------------------------------"
239251
echo "##Total time elapsed for SnapRAID: $ELAPSED"
240-
mklog "INFO: Total time elapsed for SnapRAID: $ELAPSED"
252+
mklog "INFO: Total time elapsed for SnapRAID: $ELAPSED"
241253

242254
# Add a topline to email body
243255
sed_me "1s:^:##$SUBJECT \n:" "${TMP_OUTPUT}"
244256
if [ $VERBOSITY -eq 1 ]; then
245257
send_mail_verbose
246258
else
247-
send_mail
259+
send_mail
248260
fi
249261
fi
250262

0 commit comments

Comments
 (0)