Jump to content

Synching with Server


This topic is 4984 days old. Please don't post here. Open a new topic instead.

Recommended Posts

So I have a client with a fairly complicated FMP file hosted on Server and they just got an iPad.

They want to carry a copy with them that's just for reference (read-only) and have it get updated nightly when they plug in and sync.

Server unfortunately always backs up to a folder within the backup folder that is named with the date and time. Any easy way to get that latest backup to sync with the iPad?

I've set it up with DropBox which works fairly well, it's just kind of manual at the moment.

Thanks for any suggestions. It's all Mac 10.5 and FMPS11.

Link to comment
Share on other sites

On Windows you could do this with a scheduled batch file. It might look something like this:

dir /b /ad /s "C:Program FilesFileMakerFileMaker ServerDataBackups">c:pathlist.txt

for /f "tokens=*" %%L in (c:pathlist.txt) do copy "%%L" C:testfolder

This would copy all the databases from Backups into testfolder, without the timestamped subdirectories. This technique can also be used for rolling 7, 30, 60 day, etc backups, though newer FM versions support rolling backups.

You should be able to do the same thing under OSX, except I believe you'd use the cp command with wildcards, to copy the backup file to the dropbox folder and clipping the timestamp directory in the process.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for your help with that. Just for reference, I've listed below the final version of the script I used that worked on OSX 10.5. Thanks again for pointing me in the right direction!

One caveat, we had to put the script into the /Library/FileMaker Server/Data/Scripts/ folder and we had to edit the sudoers file as detailed in this Filemaker note:

• To use a user account to run a script in Mac OS, you must add the following entries to the

/etc/sudoers file:

Host_Alias FMSHOST = yourhostname

Defaults:fmserver targetpw, timestamp_timeout=0, passwd_tries=1

fmserver FMSHOST = (ALL) /Library/FileMaker Server/Data/Scripts/*, /bin/kill

For the Host Alias, enter the name of the host running FileMaker Server. You cannot use “localhost” or 127.0.0.1.

To find out the correct host name to use, enter the following command in the Terminal application:

hostname

To edit the /etc/sudoers file, you must be the Administrator (root) and have Administrative privileges.

You can edit the /etc/sudoers file using this command in the Terminal application:

sudo visudo

• The User Account you can use to run system-level scripts must have the correct privileges for the actions you want the script to perform. The type of account depends on your operating system:

• In Windows, you can use the Local System account or a user account. The account can be a local account on the master machine or a network domain account.

• In Mac OS, you can use the fmserver user account or a local user account on the master machine only. You cannot use a network domain account.

If you choose the fmserver user account, you may need to modify file permissions for the script. Your script is executed with the fmserver user ID and fmsadmin group ID, so your script file must have read and execute permissions for the fmsadmin group. Therefore, if you choose the fmserver user account, you cannot call some privileged commands from your scripts. For example, your script does not have access to the /etc folder.

• Script name and Parameters added together can be a maximum of 2048 characters.

• In Windows, User Name can be a maximum of 104 characters, and Password can be a maximum of 128 characters.

• In Mac OS, User Name can be a maximum of 255 characters, and Password can be a maximum of 31 characters.

------------------------

We ended up running the script as the local admin user (specified in Filemaker Server Admin) since we needed access to the users home folder. It now works perfectly!

FYI, this shell script finds any file named "Music.fp7" that's in a dated Filemaker backup folder inside of the DropBox folder. i.e., the file path is "/Users/Rocky/Dropbox/Backup_2010-08-22_1500/Databases/Music.fp7" and it copies it to the destination folder. I have server backing it up here every 4 hours and keeping only one backup.

# Script Start here-------

#!/bin/bash

SRC_DIR=/Users/Rocky/Dropbox/

DST_DIR=/Users/Rocky/Documents/iPadFiles

SEARCH="*Music*"

DEPTH=3

for i in `find $SRC_DIR -maxdepth $DEPTH -name "$SEARCH"`;

do

cp $i $DST_DIR/;

done

Hope this helps someone else with an iPad running Filemaker Server.

Mike

Link to comment
Share on other sites

Well, everything isn't working quite as well as I'd thought...

Now we have the database backing up, but the user needs to manually delete the file from the iPad every time before synching. It doesn't replace the one on the iPad with the newer one on the computer... :-(

Also the file is periodically getting corrupt. Most of the time we manually sync the file wont open on the iPad. Recovering the backup will fix it, but do we really have to do that almost every time?

Any thoughts?

Mike

Link to comment
Share on other sites

Yes... leave the file on the iPad, and perform a scripted process to "import" the data from the main system into the local system.

I say "import" using inverted commas because the import script step is not supported in FM Go. The process would therefore be something along the lines of relating the main and local tables and walking through the records to work out which need to be updated, which have been deleted and which need to be created.

For example, walk through the local table, if it has no related record in the main table then it should be deleted. If it has a related record then update the fields. Walk through the records in the main table, if they don't have a related local record then create one.

Link to comment
Share on other sites

  • 2 weeks later...
  • Newbies

I'm happy to have found these scripts.....however, I have a much simpler issue, for you guys, not me.

Same scenario, FileMaker Pro small database (2,500 records) on a XP box (not FM Server, but stand alone).

Just got client an iPad to have DB accessible w/Filemaker Go app.

However, I'd like to have the FM7 file automatically synced to the iPad with no end user intervention.

Is this a similar process as outlined here, or can I not have a batch file put the file in the necessary iPad file location so it sync's daily (automatically)?

Link to comment
Share on other sites

  • 2 weeks later...

However, I'd like to have the FM7 file automatically synced to the iPad with no end user intervention.

Errrr... they would of course have to have started the iPad and run up FM Go first.

Why not sync using scripting (Import) when the file is first started?

Link to comment
Share on other sites

This topic is 4984 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.