FileMaker Server has a built-in capability for executing scheduled tasks. The three types of tasks that can be scheduled are database backups, execution of batch scripts, and sending messages to connected users.
The Server Administration Tool is used to create scheduled tasks. On Windows, you use the Task Scheduling Assistant, which walks you through a series of seven screens, prompting you for a few bits of information about the schedule on each screen. On Mac OS X, you can click the New button while viewing the schedule list, or you can select Action, Schedules, New Schedule. The new task dialog on Mac OS X is shown in Figure 25.16.
The information you are asked to provide when setting up a schedule is quite obvious and intuitive; we don need to go over every option here. There are, however, a few important facts and tips that are worth knowing. First, you can create no more than 50 scheduled tasks. Weve never seen anyone get anywhere near this limit, so it shouldn be an area of concern for you. Second, new tasks are set to be enabled by default. Finally, if you need to create many similar scheduled tasks, its best to create one and then duplicate it, changing each copy as appropriate to get the desired variation (backup schedules that vary only by the day of the week, for example).
You can see a list of all the tasks that are scheduled by navigating within the SAT to the Schedules screen, which is shown in Figure 25.17.
From the schedule list you can see a lot of useful information about the status of your scheduled tasks. For instance, you can see the date and time the task was last executed, as well as the date and time of the next scheduled execution. A check mark at the beginning of the line indicates that a task is enabled.
If you ever need to suspend task execution because of system maintenance or other troubleshooting activities, its better to simply disable any tasks that are waiting to be run rather than to delete them.
You can edit any tasks options by double-clicking on it from the task list. If you right-click (Windows) or Control-click (Mac), you will see a list of other actions you can perform. These include running the task immediately, enabling or disabling the task, and duplicating the task. You can also delete a task this way.
If you schedule tasks in such a way that one task isn finished by the time the next one is ready to begin, the second task is delayed until the first one has finished executing.
The most commonly scheduled tasks are database backups. The frequency of backups is dependent on your business needs. Some organizations back up their data once a day; others back up every hour during the day. The general rule of thumb is that your backup frequency should be based on how much data you e willing to lose. If you always base your assumptions on worst-case scenarios, youll probably be well covered in the event such a scenario comes about.
When you set up a backup schedule, you can specify whether all databases should be backed up or just those in a particular folder. Typically, youll choose to back up all the databases. The main reason to back up just those in a particular directory is if you have some number of very large files that don change often, such as a data archive or large lookup table. You can place those databases in their own directory and back them up on a less frequent basis than your main production files. This results in less time required to perform the backup, but more importantly, the backups take up less hard drive space.
You also must specify a directory in which the backup files are placed. When you install FileMaker Server, a folder called Backups is automatically set up for you within the Data directory. You can use that directory for your backups, or specify another valid directory path if thats preferable.
If space permits on your hard drive, its a good idea to have multiple destination folders set up for your backups so that they don overwrite one another. For instance, if you back up daily, you should have a Monday folder, a Tuesday folder, and so on, and set up separate schedules for each days back up. This ensures that you always have several backups of varying ages if theres ever a problem. Sometimes youll discover a data problem days after it occurs, so being able to go back to older backups comes in handy.
If the drive to which you are backing up runs out of space during the backup, the backup is aborted, any partial files that have been created are deleted, and an error is written to the server logs. Be sure to periodically check (once a month, at least) that your backups are being created as expected and that you have adequate drive space.
FileMaker Server 7 and 8 perform backups slightly differently than previous versions of FileMaker Server did. It used to be the case that databases were put into a paused state during a backup. Users would commonly experience a coffee-cup icon if they attempted to access a paused database.
FileMaker Server now performs a live backup that requires significantly less time when the databases are unavailable. At the beginning of the backup process, FileMaker Server flushes the cache so that any data saved in memory is written to disk. Then it creates a dirty copy of the file. Users can still access and modify the original file while this copy is being made. After thats finished, the live database is paused and compared to the dirty copy; incremental changes are made to the copy so that it reflects the current state of the live file. The pause required for the incremental update is usually quite short and may not even be perceptible to users.
In addition to database backups, you can also use FileMaker Server to schedule the execution of script files. On Windows, script files might be batch files or something like a WinBatch executable file. On Mac OS X, script files might be AppleScript applets or UNIX batch files. Scripts must be placed within the Scripts directory, which is located in the Data folder.
Script files are typically used to perform activities such as copying backup files to remote drives and compressing copies of backup files. Pretty much anything that you can do from the command line on either platform can be done through a batch file. You can even use FileMaker Servers command-line interface commands to have your batch scripts act on FileMaker Server itself. See the section called "Administration from the Command Line" in this chapter to learn more about the types of activities this enables.
The final type of task that can be scheduled directly from FileMaker Server is sending messages to users. Messages can be sent either to all users connected to the server or just those using databases in a certain folder.
Sending messages via the server is useful for notifying users of scheduled downtime for the server or to remind them of periodic events.
Part I: Getting Started with FileMaker 8
Using FileMaker Pro
Defining and Working with Fields
Working with Layouts
Part II: Developing Solutions with FileMaker
Relational Database Design
Working with Multiple Tables
Working with Relationships
Getting Started with Calculations
Getting Started with Scripting
Getting Started with Reporting
Part III: Developer Techniques
Developing for Multiuser Deployment
Advanced Interface Techniques
Advanced Calculation Techniques
Advanced Scripting Techniques
Advanced Portal Techniques
Debugging and Troubleshooting
Converting Systems from Previous Versions of FileMaker Pro
Part IV: Data Integration and Publishing
Importing Data into FileMaker Pro
Exporting Data from FileMaker
Instant Web Publishing
FileMaker and Web Services
Custom Web Publishing
Part V: Deploying a FileMaker Solution
Deploying and Extending FileMaker
FileMaker Server and Server Advanced
Documenting Your FileMaker Solutions
Special Edition Using FileMaker 8
Authors: Scott Love, Steve Lane