Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi,

Is fmsadmin async or sync? I'm asking because when I launch a backup script, some files were closed before the backup could complete.

Here is my code :


@echo off

echo %date%;%time%;backup;quotidien;démarrage;>>log_backup.txt

set fm="c:Program FilesFileMakerfilemaker serverDatabase serverfmsadmin" -u XYZ -p 123

%fm% send -m "The daily backup is starting.  You might notice a little slow down for the next 30 minutes."



:FM_RUN_BACKUP

%fm% run schedule 2



REM DOES IT WAIT THE SCHEDULE IS FINISH BEFORE EXECUTING THE NEXT COMMAND?



:FM_CLOSE_FILES

%fm% CLOSE -y -m "The daily backup has finished. The system will close all files for the night in 30 minutes." -t 1800



:COMPRESS_BACKUP

copy_backup_to_external.vbs



:END_SCRIPT

Thanks for any advice

I'm not sure why you're closing files for backup.

The best practice is to use a FMS schedule to backup the databases, then (after enough time has been allowed for the process to complete) run an OS-level script that works on the backup files that were just created. Never try to do anything with the hosted files. So the schedule might run at 11:00 pm and the OS backup script might run at 2:00 pm.

Closing the hosted files is IMHO should not be required for a regular event like a backup because the whole point of hosting with FMS is to get the files available 24x7. They should only ever be closed if there is a problem like a power failure or for scheduled maintenance.

  • Author

Hi,

Actually, I need to close the files because the server (PC) has been physically unstable for the last 2 weeks especially at night.

We ordered the new mac mini server and it should be in next week (That's what the salesman told us).

When the new setup will be ok, I won't need to close the files anymore.

About the backup and file closing,

I had some bad experience with a schedule that should be terminated at an X time. That's why I prefer having full control about the sequence timing than guessing at what time a schedule should be completed.

I think what you need to do is not start a schedule, but actually start a backup directly.

When you tell fmsadmin to run a schedule, it just sends a message to the scheduler, which then launches a separate backup process. So it won't wait for the schedule to finish.

The easiest way to do this would be to directly run the backup from within your script, rather than using the schedule.

So do something like this instead:

:FM_RUN_BACKUP

%fm% backup FilenameToBeBackedup PathToBackup -options



:FM_CLOSE_FILES

%fm% CLOSE -y -m "The daily backup has finished. The system will close all files for the night in 30 minutes." -t 1800



:COMPRESS_BACKUP

copy_backup_to_external.vbs

  • Author

Hmmm... that's worth giving it a try!

Thanks

Do [color:red]not attempt to create a backup from an OS level script. Have FileMaker Server create the backup. Then you can copy that backup elsewhere if you need to do so.

Steven

  • Author

I haven't done the script modification yet, but what is the reason why it is not recommended to create an OS level backup?

a batch file is very poor vehicle for what you are trying to do. Do this all in a VBscript instead, this way you can execute a command line from within your VBscript and actually WAIT until it is done before moving on.

The way you're doing it in your batch file is asynch: you firing off commands but they don't wait for each other.

Since you're not using the OS for the backup, but using the FMS backup command, you're fine. The problem is in the way you structure the whole thing: you have a batch file that is calling commands but not waiting and then even calling a VBscript.

Put it all in a VBscript and you'll be fine. Use the Exec function to run the command lines and put the VBscript in a waiting loop until the command resports that it is done.

  • Author

Thanks Wim, I've done a VBScript last week and it's running not so well.

I'm still having problem closing files. The script hang when running FM task scheduler.

Here's the code :)


%fm% CLOSE -m -y "It is now %TIME%, the system will close all files for the night."

Where %fm% is the fmsadmin command with user and password.

Concerning the backups, when the script launches a scheduled task it's still async. I guess, I'll have to script the backup using the backup command. But some people say that it is not recommend, which I ignore why.

Confused, here Nick. You're posting only one line of code and it's not VBscript syntax.

Until you explictely use code to call the fmsadmin command line AND wait for the result, everything will be async.

The line of code you're posting is not for running a task schedule so I'm not sure what's up with that.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.