Add various scripts for MinIO and Restic backup management

This commit is contained in:
William Valentin
2025-10-24 11:48:52 -07:00
parent 7bd5974ac4
commit 27560832a2
10 changed files with 500 additions and 0 deletions

24
scripts/chezmoi-sync.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/bash
current_time=$(date +"%d-%m-%Y-%H")
log_filename="${current_time}.log"
# Redirect stdout and stderr to the log file
exec > >(tee -a "$log_filename") 2>&1
cd $HOME || { echo "Failed to change directory to $HOME"; exit 1; }
# Run the 'chezmoi managed' command and save the output to a variable
managed_files=$(chezmoi managed)
if [ $? -ne 0 ]; then
echo "Error during the execution of 'chezmoi managed'"
exit 1
fi
while IFS= read -r file; do
# Run the 'chezmoi add' command for each file
chezmoi add "$file"
done <<< "$managed_files"