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
7
7
8
8
build :
9
9
@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 )
12
12
@chmod +x $(MERGED_SCRIPT )
13
13
14
14
clean :
Original file line number Diff line number Diff line change @@ -38,17 +38,20 @@ logger() {
38
38
39
39
# Check if logging is enabled
40
40
if [[ " ${LOG_ENABLED} " -lt 1 ]]; then
41
- return # Exit the function without printing anything
41
+ # Exit the function without printing anything
42
+ return
42
43
fi
43
44
44
45
# Check if the log level is valid or not
45
46
if [[ -n ${log_levels[$log_level]} ]]; then
46
47
# Check if the log level is greater than or equal to the current log level
47
48
if (( log_levels[$log_level ] >= log_levels[$LOG_LEVEL ])) ; then
48
49
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 "
50
52
else
51
- echo " [$dt ] [$log_level ] $message " # Print to stdout
53
+ # Print to stdout
54
+ echo " [$dt ] [$log_level ] $message "
52
55
fi
53
56
54
57
# 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() {
110
110
logger " INFO" " Killing SSH connections"
111
111
# Loop through each connection and kill the SSH process and its children
112
112
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]}
115
117
116
118
logger " INFO" " Killing SSH process for host $host (PID: $subshell_pid )"
117
119
# Kill the subshell process and its children
Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ load_rules() {
27
27
logger " FATAL" " rules.txt is empty"
28
28
fi
29
29
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
32
34
33
35
# Loop through each line of the rules file
34
36
while IFS= read -r line; do
@@ -37,7 +39,8 @@ load_rules() {
37
39
continue
38
40
fi
39
41
40
- (( line_no++ )) # Increment the line number
42
+ # Increment the line number
43
+ (( line_no++ ))
41
44
42
45
logger " DEBUG" " Processing line $line_no : $line "
43
46
You can’t perform that action at this time.
0 commit comments