File tree Expand file tree Collapse file tree 4 files changed +18
-10
lines changed
Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ all: build
77
88build :
99 @mkdir -p build
10- @echo ' #!/bin/bash' > $(MERGED_SCRIPT ) # Add shebang
11- @cat $(SCRIPTS ) | grep -v ' ^source' >> $( MERGED_SCRIPT ) # Append script contents
10+ @echo ' #!/bin/bash' > $(MERGED_SCRIPT )
11+ @cat $(SCRIPTS ) | grep -v ' ^source' | sed ' /^#!/,$$!d ' | sed ' /^\s*#/d ' | sed ' /^\s*$$/d ' >> $( MERGED_SCRIPT )
1212 @chmod +x $(MERGED_SCRIPT )
1313
1414clean :
Original file line number Diff line number Diff line change @@ -38,17 +38,20 @@ logger() {
3838
3939 # Check if logging is enabled
4040 if [[ " ${LOG_ENABLED} " -lt 1 ]]; then
41- return # Exit the function without printing anything
41+ # Exit the function without printing anything
42+ return
4243 fi
4344
4445 # Check if the log level is valid or not
4546 if [[ -n ${log_levels[$log_level]} ]]; then
4647 # Check if the log level is greater than or equal to the current log level
4748 if (( log_levels[$log_level ] >= log_levels[$LOG_LEVEL ])) ; then
4849 if [[ -n ${LOG_FILE} ]]; then
49- echo " [$dt ] [$log_level ] $message " >> " $LOG_FILE " # Append to log file
50+ # Append to log file
51+ echo " [$dt ] [$log_level ] $message " >> " $LOG_FILE "
5052 else
51- echo " [$dt ] [$log_level ] $message " # Print to stdout
53+ # Print to stdout
54+ echo " [$dt ] [$log_level ] $message "
5255 fi
5356
5457 # If the log level is 'FATAL', exit with status code 1
Original file line number Diff line number Diff line change @@ -110,8 +110,10 @@ kill_ssh_connections() {
110110 logger " INFO" " Killing SSH connections"
111111 # Loop through each connection and kill the SSH process and its children
112112 for user_host_port in " ${! SUBSHELL_PIDS[@]} " ; do
113- local host=${user_host_port%:* } # Extract the hostname from the user_host_port string
114- local subshell_pid=${SUBSHELL_PIDS[$user_host_port]} # Get the subshell PID for the connection
113+ # Extract the hostname from the user_host_port string
114+ local host=${user_host_port%:* }
115+ # Get the subshell PID for the connection
116+ local subshell_pid=${SUBSHELL_PIDS[$user_host_port]}
115117
116118 logger " INFO" " Killing SSH process for host $host (PID: $subshell_pid )"
117119 # Kill the subshell process and its children
Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ load_rules() {
2727 logger " FATAL" " rules.txt is empty"
2828 fi
2929
30- local current_host=" " # Variable to keep track of the current host being processed
31- local line_no=0 # Variable to keep track of the current line number
30+ # Variable to keep track of the current host being processed
31+ local current_host=" "
32+ # Variable to keep track of the current line number
33+ local line_no=0
3234
3335 # Loop through each line of the rules file
3436 while IFS= read -r line; do
@@ -37,7 +39,8 @@ load_rules() {
3739 continue
3840 fi
3941
40- (( line_no++ )) # Increment the line number
42+ # Increment the line number
43+ (( line_no++ ))
4144
4245 logger " DEBUG" " Processing line $line_no : $line "
4346
You can’t perform that action at this time.
0 commit comments