CHylton Posted March 6, 2009 Posted March 6, 2009 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
Steven H. Blackwell Posted March 7, 2009 Posted March 7, 2009 This is a puzzler. A batch file should run. Remember that FMS runs as Local System. Are there any privileges attached to the script that are different. Because it's in the directory, it should be in the bubble. Steven
Wim Decorte Posted March 9, 2009 Posted March 9, 2009 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.
CHylton Posted March 9, 2009 Author Posted March 9, 2009 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
VFXdbGuy Posted April 28, 2009 Posted April 28, 2009 I too am trying to get Windows (DOS) batch files to be run as post-scripts on Server 10. Can a DOS batch file be run by FMServer 10 or do I have to only use scripts that use FM command line commands?
VFXdbGuy Posted April 28, 2009 Posted April 28, 2009 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...)
Steven H. Blackwell Posted April 29, 2009 Posted April 29, 2009 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
VFXdbGuy Posted April 29, 2009 Posted April 29, 2009 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.
Steven H. Blackwell Posted April 29, 2009 Posted April 29, 2009 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
Wim Decorte Posted April 29, 2009 Posted April 29, 2009 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,...)
Wim Decorte Posted April 29, 2009 Posted April 29, 2009 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
Recommended Posts
This topic is 5687 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 accountSign in
Already have an account? Sign in here.
Sign In Now