Update scripts/dccd2.sh
This commit is contained in:
parent
14dbede998
commit
fbbaffc857
1 changed files with 20 additions and 24 deletions
|
@ -77,20 +77,16 @@ update_compose_files() {
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the docker-compose.yml file in this folder has changed
|
# Check if any changed file is within this directory
|
||||||
compose_file_changed=false
|
changed_file_in_dir=false
|
||||||
for file in $changed_files; do
|
for file in $changed_files; do
|
||||||
log_message "DEBUG: Comparing changed file: $file" # Added debug line
|
if [[ "$file" == "$folder"* ]]; then
|
||||||
log_message "DEBUG: With target file: $folder/docker-compose.yml" # Added debug line
|
changed_file_in_dir=true
|
||||||
log_message "DEBUG: Length of changed file: ${#file}"
|
|
||||||
log_message "DEBUG: Length of target file: ${#folder/docker-compose.yml}"
|
|
||||||
if [[ "$file" == "$folder/docker-compose.yml" ]]; then
|
|
||||||
compose_file_changed=true
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if $compose_file_changed; then
|
if $changed_file_in_dir; then
|
||||||
# Go into the directory
|
# Go into the directory
|
||||||
cd "$folder" || { log_message "ERROR: Failed to enter directory $folder"; send_notification "Script Error" "Failed to update compose files: Failed to enter directory $folder"; continue; }
|
cd "$folder" || { log_message "ERROR: Failed to enter directory $folder"; send_notification "Script Error" "Failed to update compose files: Failed to enter directory $folder"; continue; }
|
||||||
|
|
||||||
|
@ -101,7 +97,7 @@ update_compose_files() {
|
||||||
# Go back to the original directory
|
# Go back to the original directory
|
||||||
cd "$dir" || { log_message "ERROR: Failed to return to directory $dir"; send_notification "Script Error" "Failed to update compose files: Failed to return to directory $dir"; exit 1; }
|
cd "$dir" || { log_message "ERROR: Failed to return to directory $dir"; send_notification "Script Error" "Failed to update compose files: Failed to return to directory $dir"; exit 1; }
|
||||||
else
|
else
|
||||||
log_message "INFO: No changes detected in docker-compose.yml for $folder, skipping..."
|
log_message "INFO: No changes detected in $folder, skipping..."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|
Reference in a new issue