-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improving backup_and_restore.sh
script before new-coming features
#6030
base: staging
Are you sure you want to change the base?
Improving backup_and_restore.sh
script before new-coming features
#6030
Conversation
Since it might have spaces, it must be double quoted.
Previous code was not checking if the path is a `symbolic` to a filesystem, if user is root and the given path is a `symbolic` of filesystem then it will overwrite it!
Implement `check_required_tools` function in `backup_and_restore.sh` script, as well call it in the beginning of the script instead of at the end
Hey @DerLinkman, you can now resolve this PR, since I will need a few time to refactor and fully test the |
Hello @h3ssan! Is this pr now ready to merge or not? If not, we can convert it to a draft. |
Hey there @DerLinkman , yes it’s ready to be merged. still there’s 2 functions I need to look into but might take some time so yes, resolve it |
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.
Looks fine!
ClarificationCommit Original Code i=1 # Starts at 1, even before finding any folder
declare -A FOLDER_SELECTION
if [[ $(find "${BACKUP_LOCATION}"/mailcow-* -maxdepth 1 -type d 2> /dev/null| wc -l) -lt 1 ]]; then
echo -e "\e[31mSelected backup location has no subfolders\e[0m"
exit 1
fi
for folder in $(ls -d "${BACKUP_LOCATION}"/mailcow-*/); do
echo "[ ${i} ] - ${folder}"
FOLDER_SELECTION[${i}]="${folder}"
((i++))
done
If
Here we have |
`backup_and_restore.sh` script, with `restore` flag, crashes when entering a non-numeric value as backup choice
ClarificationCommit: Fix: Crash on entering non-numeric value, fixes the following issue: Enter |
Fix the crash on entering non-numeric value, as well as make the code more readable
Till this point, what I have tested is below:
|
cc8c889
to
ea24505
Compare
Refactor `backup_and_restore.sh` script, implement `declare_restore_point` function.
Sorry about the last commit, there was an issue with the |
Please note that this commit |
Refactor `backup_and_restore.sh` script, implement `declare_file_selection` function
Implement `restore_docker_component` function to restore `vmail`, `redis`, `crypt`, `rspamd` and `postfix`, all from one function
Thank you @DerLinkman for the testing process. sorry I know it's noisy but necessary. |
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.
See comment
How does this script behave when it is automated? E.g runned via cron? Especially the part with -d (delete backups) you have to enter YES to confirm deletion? |
For now, it won't. In the next feat PR, I'll make it automated. |
That makes it hard for us to track... as we always take all staging commits into the next update and we await the full functionality of that. If you say that the automation is not implemented yet inside this pr, then we won't merge it... i'm sorry. As this is heavily used by other users. In general: Why did you want to make multiple prs instead of one which includes all of your changes, even the new additions? I did not get it. |
Then, If something happened unexpected, we will revert everything instead of the PR that has the problem. Please correct me if I am wrong. As well, many features inside one PR will make the testing harder. If you resist, then it's ok for me. Please confirm that you need the full implementation inside this PR and I'll start make the script fully automated. |
I definitely unterstand your doing. I prefer this. But currently your backup script is removing a automated part. So yes: Please readd the automation into your scripts remake PR. |
The script now can be automated using Example: ./helper-scripts/backup_and_restore.sh --delete /opt/backup 7 --yes
|
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.
See comment (only one :D) rest looks fine to me.
However, we need to adjust the mailcow docs too. Do you want to do it by yourself or should we adapt it?
Just asking, that we don't do the same work parallel :D
Sure, I’ll do adjust the docs! |
Full error message: ``` Error: auth-master: userdb list: connect(/run/dovecot/auth-userdb) failed: Connection refused Panic: file auth-master.c: line 436 (auth_master_unset_io): assertion failed: (conn->to == NULL) ```
@MAGICCC could you try to test this too? It works and looks good for me but if a seperate user can take a look at this i would be happy |
Yes I will check on the weekend! |
Thank you! |
Would be awesome to include this as well: #4833 |
aaee040
to
4d688c5
Compare
Contribution Guidelines
What does this PR include?
print_usage
function tobackup_and_restore.sh
scriptbackup_and_restore.sh
scriptthread count notice
into theprint_usage
BACKUP_LOCATION
. - Critical: Since it might has spaces therefore will corrupt the backup/restore process.symbolic
to a filesystem, if user is root and the given path is asymbolic
of filesystem then it will overwrite it!check_required_tools
function inbackup_and_restore.sh
script, as well call it in the beginning of the script instead of at the endShort Description
This PR is not finished yet, I'll include many re-write code for the
backup_and_restore.sh
script. Enhancement, refactor and improved code, before starting to implement a new features.Affected Containers
None
Did you run tests?
Tested manually
What did you tested?
backup_and_restore.sh
scriptWhat were the final results? (Awaited, got)
All good