-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase number of stored copies #8
base: main
Are you sure you want to change the base?
Conversation
Использовать вот так:
скрипт копирует в ../backups папки и называет их |
keep_n_backups_for_templates.sh
Outdated
fi | ||
|
||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 N folder1 [folder2 ... folderN]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поясните, как интерпретируются аргументы folderN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
пока реализовано так:
передаем N - число хранимых копий
а потом как минимум 1 папку, но можно и больше папок, которые копируем, то есть для 1 курса пми по проге будет выгляжеть так:
./keep_n_backups_for_templates.sh 5 pr-2024-4381 pr-2024-4382 pr-2024-4383 pr-2024-4384 pr-2024-4385 pr-2024-4388
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да, у меня не очень удачное описание, тут N количество и folderN никак не свзяаны в них N
echo "Folder $folder copied into $BACKUP_DIR/$new_folder_name" | ||
} | ||
|
||
for folder in "${FOLDERS[@]}"; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По задумке folder1 [folder2 ... folderN] это подстроки от начала имен папок.
Например, у нас могут быть папки вида:
pr-2023-1, pr-2024-5, cs-2025-6
Мы передаем в качестве аргументов:
pr-2023- и cs-2025-
соответственно, должны быть обработаны только каталоги, которые начинаются с одной из этих подстрок.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хм, понял, пока работает так, что нужно прописать полные название копируемых папок (pr-2023-3381 pr-2023-3382 и тд)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавил prefix
теперь запускать нужно так:
./new.sh 5 pr-2024
Вот как будет выглядеть вывод:
Start copy pr-2024-4388 into ../backups/pr-2024-4388_2024_11_20_16_53
Folder pr-2024-4388 copied into ../backups/pr-2024-4388_2024_11_20_16_53
Start copy pr-2024-4382 into ../backups/pr-2024-4382_2024_11_20_16_53
Folder pr-2024-4382 copied into ../backups/pr-2024-4382_2024_11_20_16_53
Start copy pr-2024-4381 into ../backups/pr-2024-4381_2024_11_20_16_53
Folder pr-2024-4381 copied into ../backups/pr-2024-4381_2024_11_20_16_53
Start copy pr-2024-4383 into ../backups/pr-2024-4383_2024_11_20_16_53
Folder pr-2024-4383 copied into ../backups/pr-2024-4383_2024_11_20_16_53
Start copy pr-2024-4384 into ../backups/pr-2024-4384_2024_11_20_16_53
Folder pr-2024-4384 copied into ../backups/pr-2024-4384_2024_11_20_16_53
Start copy pr-2024-4385 into ../backups/pr-2024-4385_2024_11_20_16_53
Folder pr-2024-4385 copied into ../backups/pr-2024-4385_2024_11_20_16_53
Started deleting ../backups/pr-2024-4388_2024_11_20_16_44
Deleted old copy ../backups/pr-2024-4388_2024_11_20_16_44
Started deleting ../backups/pr-2024-4382_2024_11_20_16_44
Deleted old copy ../backups/pr-2024-4382_2024_11_20_16_44
Started deleting ../backups/pr-2024-4381_2024_11_20_16_44
Deleted old copy ../backups/pr-2024-4381_2024_11_20_16_44
Started deleting ../backups/pr-2024-4383_2024_11_20_16_44
Deleted old copy ../backups/pr-2024-4383_2024_11_20_16_44
Started deleting ../backups/pr-2024-4384_2024_11_20_16_44
Deleted old copy ../backups/pr-2024-4384_2024_11_20_16_44
Started deleting ../backups/pr-2024-4385_2024_11_20_16_44
Deleted old copy ../backups/pr-2024-4385_2024_11_20_16_44
541c579
to
1d44913
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В целом, ок - добавил в джобу бакапов
до 02.12 смотрим - потом мержим
No description provided.