Jump to content
Server Maintenance This Week. ×

Server-Side System Level Scripts


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

Recommended Posts

Morning all: I have run into a head scratcher here, and I'm hoping that someone here has seen this before. I am trying to accomplish a close of all hosted databases on my Server 9 Advanced (Windows 2003) through the use of command line fmsadmin commands.

I have a simple batch file (put into the datascripts folder on my server) which uses the following command:

fmsadmin CLOSE -y -u user -p pass

This should, in theory, close all hosted files.

I am triggering this through the FM Server schedules. The batch runs fine through the scheduler, however, it does not close the files, nor does it error out.

If I run manually through the command prompt by typing the commands, it works as expected. But, I need to have this task automated. Has anyone else seen this behavior before, and what can be done to fix it? I have tried both a .BAT files and a .VBS files, all with the same results.

The reason I need to automatically close databases is that my solution is quite large, and sometimes the VBScript I have written to shut down the FM Service will time out when there are users who have forgotten to disconnect before leaving for the day.

Thanks in advance.

Chris Hylton

Systems Analyst

Link to comment
Share on other sites

An alternative is to have your VBscript ask FMS for a list of connected clients and disconnect those in a loop before proceeding with closing the files (again, one by one in a loop) and then shut down the FMS service.

This way you can trap for errors each step of the way and the VBscript will never time out.

Link to comment
Share on other sites

Thanks for the help. Over the weekend, I decided to stick to what I know, and what works. Instead of using the FileMaker Server to run the tasks, I am running them through the Windows Scheduler, and they work just fine.

My shutdown routine becomes a 30 minute process, with 3 VB scripts to do so (eventually, I'll roll them back into 1 script). At 0 past the hour, disconnect all clients, at 15 past the hour close all hosted databases, and a 30 past the hour stop the FileMaker Server service.

Thanks again.

Chris

Link to comment
Share on other sites

  • 1 month later...

But...

this batch file runs fine on the server when run by the Service account that runs the Filemaker server. It reports "1 file copied":

date /t >> d:filemakerdatadocumentserrors.txt

time /t >> d:filemakerdatadocumentserrors.txt

copy /Y D:filemakerdatadocumentsshotlist.csv datajobmandelaprodtrackerexportshotlist.csv >>D:filemakerdatadocumentserrors.txt

But run by the FM server itself it reports "0 files copied"

Why would it not run when the server initiates it? Filemaker Server reports no errors (though I doubt it waits for a response from the batch file...)

Link to comment
Share on other sites

FileMaker Server runs in a security bubble under Local System. The OS runs under a different account. Local System may not have privileges to write the file. Can you use the "Run As" capability to change the account that the batch file uses?

Steven

Link to comment
Share on other sites

I have changed the account that runs FMServer to a our Services account, the same account that runs our SQL server. It is a non-human account known only to Sys Admins

Logged in as that account, the batch runs correctly. But while the FMServer appears to run the batch file, the result is zero files copied.

If necessary, I will revert to using Windows Scheduled tasks but it would be nice to have it in one package.

Link to comment
Share on other sites

I think you have done it backwards. Leave FMS alone, put it back where it was. Change the batch file to Run As the known good Account from Task Maanger.

The most likely explanation of why no files are being copied is that the permissions don't exist for FMS to do that.

Steven

Link to comment
Share on other sites

Yes, batch files can run as part of the new FMS10 script sequences.

Remember that they run als Local Service so they might not have privileges to do everything you want (like accessing a remote share,...)

Link to comment
Share on other sites

copy /Y D:filemakerdatadocumentsshotlist.csv datajobmandelaprodtrackerexportshotlist.csv >>D:filemakerdatadocumentserrors.txt

The issue could be with the fact that you're trying to copy to a remote volume. The default local service has no rights to remote volumes (by design; it would be a huge security hole if it could).

You need to change the service account that runs FMS (not recommended) or just schedule this with the Windows task scheduler where you can specify a "run as" account

Link to comment
Share on other sites

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