Scheduling administrative tasks : Running server-side scripts : Running system-level script files
 
Running system-level script files
Note  The following information is for server administrators and group administrators.
FileMaker Server can run system-level script files, such as a Windows batch command, VBScript, or OS X shell script (bash, Perl, Python). You create a Run Script scheduled task, specify the script file and optional script parameters, the user account to use to run the script, and when to run the script. Use system-level scripts to perform tasks outside of FileMaker Server.
To run a script as a scheduled task, you must place the system-level script file in the FileMaker Server Scripts folder:
Windows: [drive]:\Program Files\FileMaker\FileMaker Server\Data\Scripts\
OS X: /Library/FileMaker Server/Data/Scripts/
Windows If FileMaker Server is installed in a non-default location, the beginning portion of the default path shown above, \Program Files\FileMaker\FileMaker Server, is replaced with the path that was specified during installation. For example: \My_Path\Data\Scripts\
For information about creating system-level scripts, see the documentation for the scripting language you want to use.
You can also create a Script Sequence scheduled task that runs optional pre-processing and post-processing system-level scripts before and after a FileMaker script. See Creating Script Sequence tasks.
Notes
You must include error-handling and branching logic in your system-level scripts. Make sure that the script syntax is correct and does not hang due to infinite loops or the availability of external resources. You can select Abort schedule if time limit reached or server stopped in the Schedule assistant to abort the system-level script schedule if the script takes longer to run than the specified time limit, or if the Database Server stops. If you do not select Abort schedule if time limit reached or server stopped and a system-level script hangs, look in the Event.log file for the process ID of the hung script to terminate. (See Event log.)
In the System-level Script schedule, you must specify an account that has the correct privileges to run the system-level script. (See Selecting a system-level script to run.)
Enable some form of logging in your script so that you can troubleshoot possible permissions issues. Refer to the Apple website for information on creating log files in OS X.
Do not use system-level scripts that invoke a user interface.
Related topics 
Users, groups, and permissions (OS X)
Creating a schedule
Running server-side scripts
Scheduling administrative tasks