Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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.

Posted

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.

Posted

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.

This topic is 5237 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.