This is a simple problem, I think, but may require a complicated answer. Also, if I’ve posted this in the wrong forum, somebody please tell me so I can relocate it.
I have a lot of sensitive information on my laptop, and it lives only on my laptop. So, on a local Mac Mini I’ve set up a special user that the management can log into to get the keys to the kingdom. That Mac Mini has a WebDAV server on it.
I have one database (Wallet) that syncs with that Mini whenever it can. Wallet is a password database, and it has built-in WebDAV syncing. So, that’s easy. If something happens, management can open this user profile, open Wallet, and it will look just like I opened it yesterday on my laptop. I also run a Bento database that I constantly both update and change structurally. So, the database needs to live on my laptop. I had thought of running it off of the Mini and just sharing it. But, I can’t structurally change it through sharing, nor can I work on it at home. However, Bento doesn’t have a built-in sync feature.
I know from experience that I can put the file /Users/xxxxx/Library/Application Support/Bento/bento.bentodb on just about any computer and it will be openable by Bento. What I want to do is automate that file copying every so often to a location on the Mini, and point the Mini’s copy of Bento to that DB so they can open it and it will be working just the same.
I’ve tried this:
set SendOrReceive to button returned of (display dialog "Hey J, Sync or Cancel?" buttons {"Sending", "Cancel"} default button 2 with icon caution)
set LocalBentoFile to POSIX file "Users/xxxxx/Library/Application Support/Bento/bento.bentodb"
set WebDAVBentoFolder to POSIX file "/Volumes/topdbs/Bento/"
tell application "Finder"
try
mount volume "http://192.168.1.12/topdbs/"
end try
delay 3
if SendOrReceive = "Sending" then
duplicate LocalBentoFile to the folder WebDAVBentoFolder with replacing
end if
end tell
The interesting thing there is that each of those pieces of code works separately (or so I thought). If I run a mount volume it works great - there’s my WebDAV. If the WebDAV is already mounted, the duplicate copies just fine (or so I thought). If I try to run both together, even with a delay, something wrong happens and I end up with a tiny mess.
The “so I thought” refers to the fact that for some reason, when I copy my bento.bentodb file onto the WebDAV, even though the files size reads in Finder as 1.5 MB, it shows in the WebDAV as anywhere between 4 and 6 G. That’s weird enough.
Then I decided WebDAV probably wasn’t the way to go for the Bento file. So, I figured on the Mini I would just share the folder Users/xxxxx/Library/Application Support/Bento/ and then have a script that copied to there. So, I made something like this:
set SendOrReceive to button returned of (display dialog "Hey J, Sync or Cancel?" buttons {"Sending", "Cancel"} default button 2 with icon caution)
set LocalBentoFile to POSIX file "Users/xxxxx/Library/Application Support/Bento/bento.bentodb"
set SharedBentoFolder to POSIX file "/Volumes/Bento/"
tell application "Finder"
try
mount volume "afp://20101209-SS._afpovertcp._tcp.local/Bento/"
end try
delay 3
if SendOrReceive = "Sending" then
duplicate LocalBentoFile to the folder SharedBentoFolder with replacing
end if
end tell
The problem there is that for some reason the copying won’t happen. I can’t seem to delete any files from the Mini’s Bento folder, even though the user I’m authenticated to the Mini with was given full Read/Write via the System Preferences share pane.
Is there a better way to do this? The end result needs to be that when these people log into the Mini, there are three applications, one of them Bento, that they can open up and it looks exactly how it was the day I quit/got fired/got hit by a bus/whatever. And, what was up with that file size discrepancy in the WebDAV folder? Weird…
Caveat, I’m not super good at any of this, but I’ve done some scripts and it’s always fun. I’m open to learning and always appreciate the help.