Syncing HTTPS only distribution point

McAwesome
Valued Contributor

We recently set up Box as an HTTPS only distribution point. The good news is this works flawlessly. The bad news is that since Casper Admin can't replicate to it, every file change currently has to be done by hand. I've been trying to work around that limitation.

My goal is to create a simple script that mounts the webdav Box drive, runs rsync, and then unmounts it. I want to either schedule this to run every couple of hours or anytime the contents of the JSS folder changes. The machine it's running on is a Mac server running 10.10.5. So far, the only thing I've managed to get working fine is syncing(via rsync) to the Box distribution point if the share has been manually mounted. That's good, but it requires a user to be logged into the server at all times and manually running something. I'd like to automate it.

From what I've been reading, the best thing to do would be to write up a small shell script and schedule it to run. This should basically look like

mount_webdav -s https://dav.box.com/dav
rsync -va --delete /Path/To/JSS/ /Path/To/Box/
diskutil unmount /Volumes/dav/

This all seems straight forward enough. Lines 2 and 3 work perfectly when I run them by hand. The problem I'm running into is getting Box's webdav to mount. I can mount it without any issue if I do it through Finder, so I know the stored credentials and address are correct. I've also tried adding -i and manually putting the login information in with no luck. I can't figure out the proper format for the command.

Does anyone have a good idea of how to mount a webdav in terminal? Alternatively, does anyone have a good suggestion for syncing files to Box without using Box Sync or having to keep a specific user logged in at all times?

1 ACCEPTED SOLUTION

McAwesome
Valued Contributor

Managed to figure it out. Future reference

osascript -e ' mount volume "https://dav.box.com/dav" as user name "<box account>" with password "<password>" '
rsync -va --delete /Path/To/JSS/ /Path/To/Box/
diskutil unmount /Volumes/dav/

View solution in original post

1 REPLY 1

McAwesome
Valued Contributor

Managed to figure it out. Future reference

osascript -e ' mount volume "https://dav.box.com/dav" as user name "<box account>" with password "<password>" '
rsync -va --delete /Path/To/JSS/ /Path/To/Box/
diskutil unmount /Volumes/dav/