It’s been 3 months since I’ve bleated about quickly closing FileMaker files on FileMaker Server using a script, and nearly a year since I mentioned a windows version
so here’s some more.
A colleague (let’s call him Midds) at a client took my previous .cmd file to stop FileMaker Server and made some neat modifications:
He modified the script to run on Windows start up and shut down automatically.
The script creates little “flag” files to indicate whether to start up or shut down and uses (good?) old fashioned goto statements (it has been years since I’ve used those, but you don’t have many tools in batch files!).
It has been fantastically successful starting and stopping their FileMaker Server (which sits on a very large array of virtual machines), leading to a very hands off approach from admin.
Here is a version of the .cmd that will automatically start and stop the Athenaeum Pro files. There is plenty of documentation on Microsoft’s web site how to configure Windows to run a .cmd file on startup and shutdown.
Don’t forget to replace your FileMaker Server admin account and password.
@echo off
rem Modded by Midds
rem check if startfms.flg file exists and if so start fms
rem otherwise write stopfms.flg file write a log file and then continue
if exist C:\startfms.flg goto startfms
echo > C:\stopfms.flg
echo stop-start %username% %date% %time% >> C:\athprofmp.log
rem set variables
set myaccount=FMSADMINACCOUNT
set mypassword=FMSADMINPASSWORD
rem change to the filemaker server directory where the command fmsadmin lives
chdir "C:\Program Files (x86)\FileMaker\FileMaker Server\Database Server"
rem force disconnect all clients
fmsadmin disconnect client -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_AthenaeumPro.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_barcode.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_borrower.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_catalog.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_catalogarchive.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_catalogSupport.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_circulation.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_circulationarchive.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_MARC.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_photo.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin close file "filewin:/C:/Program Files (x86)/FileMaker/FileMaker Server/Data/Databases/ap_web.fp7" -yf -u%myaccount% -p%mypassword%
fmsadmin stop server -yf -u%myaccount% -p%mypassword%
rem delete stopfms.flg file on success and write startfms.flg file append log file and then exit
del /f /q C:\stopfms.flg
echo stop-end %username% %date% %time% >> C:\athprofmp.log
echo > C:\startfms.flg
echo start-start %username% %date% %time% >> C:\athprofmp.log
goto EOF
rem start fms delete startfms.flg file and then append log file
:startfms
chdir "C:\Program Files (x86)\FileMaker\FileMaker Server\Database Server"
fmsadmin start server
fmsadmin start wpc
fmsadmin start cwp
del /f /q C:\startfms.flg
echo start-end %username% %date% %time% >> C:\athprofmp.log
:EOF
exit












