BASH file copy/move automation
I'm trying to create a BASH script that performs an automated backup of local files.
Context: Main folder already present on Box.
1000 users will have this automated.
Bash script automation steps:
User1:
- Create Box subfolder (naming convention: username, date) < — Only user that has rights to this folder is the user that created it
- Create subfolder1, subfolder2, subfolder3
- tar local machine folder1 contents, folder2 contents, folder3 contents
- Move all tar files to their respective folders on Box
(end)
I'm new to Box APIs, so any pointers on how and where to start would be appreciated.
-
Official comment
Hi Steve,
I have some follow up questions for you before I can steer you in the right direction.
- You said the main folder is already present in Box...is this folder going to have the backup content for all 1000+ users? Who owns that folder?
- You said "Only user that has rights to this folder is the user that created it" - do you mean the service account of the application in Box that makes the API call or the user's who content is being backed up?
- Is this process going to be running on a continuing basis(how often)? Will users be changing the names/locations of local files?
- Do the users need to interact with the content in Box, as well as local on their machine?
Thanks,
Alex, Box Developer Advocate
Comment actions -
Hi Alex,
Thanks for your reply. I'll answer your questions in order:
Bullet 1: There is a top level folder, ID:0. Under that is a Backup folder that I created that will contain all user backup folders. All users in the company have access to the TOP level folder.
Bullet 2: The service account (which the user that will be using to execute the BASH script that makes the API calls), but the user executing the script (and only that user) will need to have access to the folders that the script creates (example: Backup\username).
Bullet 3: The process will be running randomly and only occasionally on various computers based on a set of conditions. The users will not need to change the names/locations of the files. The script will determine if the folder already exists.
Bullet 4: The only anticipated need for users to interact is if they need to retrieve something that was moved from their system. I don't anticipate this being a common situation.
-
Hey Steve,
Thank you for giving me more details. For a couple reasons, I'm not sure this a great use case for Box as it is designed now.
- Box has waterfall permissions, which means that anyone with access at a higher level will always see all content lower in the tree. With this being individual user's content, I'm not sure you would want all users to be able to see everyone else's stuff. You also cannot share folder id 0 with anyone - this is the root folder id for every user in Box. You could share the backup folder.
- Box works best when using it as the sole place user interact with content, rather than having users be able to make changes on their local machines and in Box. This could cause lots of duplication issues.
I would for sure reach out to your account liaison at Box to see about doing a Box Consulting engagement around development on our platform.
Thanks,
Alex, Box Developer Advocate
Please sign in to leave a comment.
Comments
3 comments