88# #####################
99# SCRIPT VARIABLES #
1010# #####################
11- SNAPSCRIPTVERSION=" 3.4" # DEV5
11+ SNAPSCRIPTVERSION=" 3.4" # DEV6
1212
1313# Read SnapRAID version
1414SNAPRAIDVERSION=" $( snapraid -V | sed -e ' s/snapraid v\(.*\)by.*/\1/' ) "
1515
1616# find the current path
1717CURRENT_DIR=$( dirname " ${0} " )
1818# import the config file for this script which contain user configuration
19- CONFIG_FILE=${1:- $CURRENT_DIR / script-config.sh }
20- # shellcheck source=script-config.sh
19+ CONFIG_FILE=${1:- $CURRENT_DIR / script-config.conf }
20+ # shellcheck source=script-config.conf
2121source " $CONFIG_FILE "
2222
23- # Check if script configuration file has been found, if not send a message
24- # to syslog and exit
23+ SYNC_MARKER=" SYNC -"
24+ SCRUB_MARKER=" SCRUB -"
25+
26+ # ###################
27+ # MAIN SCRIPT #
28+ # ###################
29+
30+ function main(){
31+ # Check if script configuration file has been found, if not send a message
32+ # to syslog and exit
2533 if [ ! -f " $CONFIG_FILE " ]; then
2634 echo " Script configuration file not found! The script cannot be run! Please check and try again!"
27- mklog_noconfig " WARN: Script configuration file not found! The script cannot be run! Please check and try again!"
35+ mklog_noconfig " WARN: Script configuration file not found! The script cannot be run! Please check and try again!"
2836 exit 1;
2937 # check if the config file has the correct version
3038 elif [ " $CONFIG_VERSION " != " $SNAPSCRIPTVERSION " ]; then
@@ -36,21 +44,12 @@ source "$CONFIG_FILE"
3644 exit 1;
3745 fi
3846
39- SYNC_MARKER=" SYNC -"
40- SCRUB_MARKER=" SCRUB -"
41-
42-
43- # ###################
44- # MAIN SCRIPT #
45- # ###################
46-
47- function main(){
4847 # create tmp file for output
4948 true > " $TMP_OUTPUT "
5049
5150 # Redirect all output to file and screen. Starts a tee process
5251 output_to_file_screen
53-
52+
5453 # timestamp the job
5554 echo " SnapRAID Script Job started [$( date) ]"
5655 echo " Running SnapRAID version $SNAPRAIDVERSION "
@@ -786,12 +785,15 @@ function clean_desc(){
786785 [[ $- == * i* ]] && exec & > /dev/tty
787786 }
788787
789- function final_cleanup(){
790- resume_services
788+ function final_cleanup() {
789+ if [ " ${MANAGE_SERVICES:- 0} " -eq 1 ]; then
790+ resume_services
791+ fi
791792 clean_desc
792793 exit
793794}
794795
796+
795797function prepare_output() {
796798# severe warning first
797799 if [ -z " ${JOBS_DONE##* " SYNC" * } " ] && ! grep -qw " $SYNC_MARKER " " $TMP_OUTPUT " ; then
0 commit comments