Skip to content
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

Create target folder if it doesn't exists #147

Open
bilogic opened this issue Apr 29, 2023 · 6 comments
Open

Create target folder if it doesn't exists #147

bilogic opened this issue Apr 29, 2023 · 6 comments

Comments

@bilogic
Copy link

bilogic commented Apr 29, 2023

Can we have an option to create the target folder if it doesn't already exists?

The thing is, I rotate my backup storage and at each rotation, the backup storage is wiped clean.
When the target folder doesn't exists, this add on writes to the root of the share instead.

Thank you!

@thomasmauerer
Copy link
Owner

Is there a reason why you're skipping the pre-checks? Otherwise the addon would stop immediately if the target directory is not found instead of writing to the root.

I think I could change that to at least try to create the target directory if it does not exist. However, I would only add that to the pre-checks as this is the place where the configuration is checked.

@bilogic
Copy link
Author

bilogic commented Apr 29, 2023

Thanks for getting back.

Just checked, I'm not skipping the pre-checks, it is disabled. I'm on 5.2.0

@thomasmauerer
Copy link
Owner

So then this means that the target directory exists when you start the addon, but somewhere between startup and the backup you delete the directory. Actually that's not really how this addon should be used.

Is it an option for you to configure a second share with the full path to your desired folder and leave target_dir empty?

@bilogic
Copy link
Author

bilogic commented Apr 29, 2023

Ok sure, I take it you want to be coding to a strict set of mechanical logic.

In that case, why copy backup to the root when target no longer exist? I mean, strictly speaking, it should just fail right?

I feel that samba is a network resource and can become unavailable due to a myriad of reasons. I guess the question is, what should the software do when target is unavailable, and when resource itself is unavailable.

The reason I have to wipe the storage when it rotates monthly is to ensure it always starts from a clean slate. The delta copying software I use sometimes gets confused about the state of the data if I don't wipe it.

If I may ask, what is the concern to check and create the target_dir before each backup? I could create a 2nd share, but I would still have to manually re-create the folder. And in this case, I would have to save this path in several parts of my system, not just Samba Backup alone.

@thomasmauerer
Copy link
Owner

In that case, why copy backup to the root when target no longer exist? I mean, strictly speaking, it should just fail right?

That's the behavior of smbclient. I wasn't aware of that to be honest.

If I may ask, what is the concern to check and create the target_dir before each backup?

I'll think about it. Probably you're right and I can adapt the current functionality.

@bilogic
Copy link
Author

bilogic commented Apr 29, 2023

That's the behavior of smbclient. I wasn't aware of that to be honest.

Thanks, that is new to me too... strange why they did it this way. I'm digressing, but imagine cp bigfile /non-existent/path/ and it goes to /.

Thank you for the consideration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants