Jacob Taylor, Jun 3, 2021, FileMaker Training Videos
Menu
- Introduction
- Ways to Manage FileMaker Server
- Why Use the Command Line?
- Getting Started with the Command Line
- Common Commands
- Advanced Command Line Options
- Integrating with Third-Party Tools
- Best Practices
- Troubleshooting Common Issues
- Conclusion
Introduction
FileMaker Server is a powerful backend that supports FileMaker solutions, offering features such as multi-user access, backups, and security configurations. While most administrators manage FileMaker Server through the Admin Console, the Command Line Interface (CLI) offers greater flexibility and control. The FMS Admin CLI allows for advanced configurations, faster troubleshooting, and automation of repetitive tasks that aren’t always possible via the GUI.
This blog post will guide you through using the FileMaker Server Command Line tool, including beginner-friendly commands and more advanced options for experienced users. You’ll learn to manage databases, automate backups, configure settings, and monitor performance directly from the command line.
Ways to Manage FileMaker Server
There are three primary ways to manage FileMaker Server:
- Admin Console: This is the graphical interface most users are familiar with. It allows you to perform a wide range of tasks, from configuring backups to monitoring system health.
- Admin API: This interface lets you programmatically interact with FileMaker Server using scripts or applications. It is commonly used for custom integrations or automating certain server tasks through web APIs.
- FMS Admin Command Line (CLI): The CLI allows direct interaction with the FileMaker Server using commands. It offers some functionality that the Admin Console doesn’t provide and is especially useful for automation, scripting, and fine-tuning server performance.
While all methods have their place, the CLI provides a more advanced level of control, allowing you to automate tasks, troubleshoot quickly, and adjust server configurations that aren’t accessible through the other methods.
Why Use the Command Line?
Using the command line has several benefits:
- Advanced Control: The CLI exposes settings and functionality that are not accessible via the Admin Console.
- Automation: You can script routine maintenance tasks, backups, and monitoring checks, reducing manual overhead.
- Faster Troubleshooting: The CLI provides quick access to logs and system information, making it easier to diagnose and fix issues in real-time.
- Remote Management: Administer FileMaker Server remotely without the need for a graphical interface.
- Consistency: By automating tasks with scripts, you ensure consistency across different servers and environments.
Getting Started with the Command Line
To begin, you’ll need access to your server’s terminal (on macOS or Linux) or command prompt (on Windows). The FMS Admin CLI is pre-installed with FileMaker Server and can be invoked by typing fmsadmin
in the terminal.
To see a list of available commands, type:
fmsadmin
To get detailed help for any specific command, you can use the help
argument. For example, if you want to learn about the list
command:
fmsadmin help list
This will show all the options and arguments you can use with that command.
Common Commands
Starting and Stopping the Server
Starting and stopping FileMaker Server is a common task for server maintenance or troubleshooting. These commands help control the server’s core processes:
- Start the Server:
fmsadmin start
- Stop the Server (with an optional warning to users):
fmsadmin stop --force --msg "Server is going down for maintenance"
If you don’t use the --force
option, connected users will receive a warning and will be given a default amount of time (which can be configured) to finish their work before being disconnected.
Managing Databases
The command line also allows direct control over individual databases, such as opening, closing, or even verifying database integrity.
- Open a Database:
fmsadmin open /path/to/database.fmp12
- Close a Database:
fmsadmin close /path/to/database.fmp12 --force
- Verify a Database: This checks for any integrity issues in the database file.
fmsadmin verify /path/to/database.fmp12
Verification is a crucial step after a crash or unexpected server shutdown, as it ensures that the database is free from corruption.
Automating Backups
Backups are essential for maintaining data integrity and ensuring that you can recover from disasters. You can automate backup tasks or trigger manual backups from the command line.
- Initiate a Backup:
fmsadmin backup --path /backup/location
By default, this command performs a live backup without interrupting users. You can specify the path for the backup or use the default backup folder.
To ensure data consistency during backups, you can pause all databases before performing the backup:
fmsadmin pause
fmsadmin backup --path /backup/location
fmsadmin resume
This method pauses all database activity before creating the backup and resumes the activity afterward.
Enabling and Disabling Services
FileMaker Server includes several services, such as WebDirect, the ODBC/JDBC service, and the Data API. You can enable or disable these services through the command line as needed.
- Enable PHP
fmsadmin set cwpconfig.enablephp=true
- Disable PHP:
fmsadmin set cwpconfig.enablephp=false
Other services like ODBC/JDBC and Data API can be managed similarly using their respective configuration settings.
Advanced Command Line Options
Monitoring Performance
FileMaker Server provides real-time status reports via the CLI, which helps you monitor the server’s health and performance. The status
command provides an overview of the system’s current state:
- Check Server Status:
fmsadmin status
This command provides information about the connected users, open databases, and general server health.
- Monitor Server Logs: You can also monitor logs directly from the command line. For example:
fmsadmin get logs event
This command pulls event logs that can help you diagnose problems related to connections, performance, or database integrity.
Managing Schedules
Managing schedules through the Admin Console can be cumbersome, especially when you need to disable or modify multiple schedules. The command line provides an easier and more efficient way to handle schedules.
- List All Schedules:
fmsadmin list schedules
- Disable a Schedule:
fmsadmin disable schedule 2
This is especially useful for temporarily disabling backup schedules during maintenance windows or when moving databases.
Configuring Cache Size
FileMaker Server’s cache size directly affects performance, especially with a large number of users or large databases. The CLI allows you to configure the cache size without needing to stop the server.
- Check Cache Size:
fmsadmin get serverconfig cachesize
- Set Cache Size (e.g., setting it to 2048 MB):
fmsadmin set serverconfig cachesize=2048
This allows for real-time adjustments to the server’s cache allocation, which can help optimize performance for different workloads.
Setting Custom Configurations
FileMaker Server has many configuration options that you can adjust using the command line. Here are a few common settings you might want to adjust:
- Set Maximum Number of Hosted Files:
fmsadmin set serverconfig hostedfiles=250
- Adjust the Event Log Size:
fmsadmin set serverconfig logsize=50
Automating Scripted Tasks
One of the most powerful uses of the command line is the ability to script repetitive tasks, such as backup rotations or user management. For example, you could create a script that automatically disables old schedules, runs a manual backup, and re-enables the schedules.
#!/bin/bash
# Disable schedule 2 and 3
fmsadmin disable schedule 2
fmsadmin disable schedule 3
# Perform a manual backup
fmsadmin backup --path /backup/location
# Re-enable the schedules
fmsadmin enable schedule 2
fmsadmin enable schedule 3
Integrating with Third-Party Tools
You can use the FMS Admin CLI to integrate with third-party monitoring tools, such as Nagios, Zabbix, or Splunk. For example, you can create custom monitoring scripts that periodically check server status, performance metrics, or log files, and then send notifications if an issue is detected.
Example: Monitoring Disk Space
#!/bin/bash
# Check disk space and send an alert if usage exceeds 90%
usage=$(df /path/to/filemaker | grep -P '\d+%' -o | tr -d '%')
if [ $usage -ge 90 ]; then
echo "Disk space is running low: $usage%" | mail -s "FileMaker Disk Alert" admin@example.com
fi
This script checks the disk space usage and sends an email alert if it exceeds 90%. You can schedule it using cron on Linux/macOS or Task Scheduler on Windows.
Best Practices
- Automate Regular Backups: Automating backups ensures you always have up-to-date copies of your databases. Use the CLI to schedule backups during off-peak hours and keep multiple backup versions for added security.
- Monitor Logs Frequently: Regularly review server logs to catch potential issues early. You can automate log monitoring using the CLI and trigger alerts if certain errors or warnings are logged.
- Script Routine Maintenance: Use scripts to automate common tasks like restarting services, adjusting cache sizes, or disabling old schedules. This reduces manual work and ensures consistency across your servers.
- Keep Databases Verified: Make it a habit to verify databases after unexpected shutdowns or server crashes to catch corruption issues before they become severe.
- Limit User Access During Maintenance: Before running maintenance tasks, ensure users are disconnected, or schedule maintenance windows during low-usage periods.
Troubleshooting Common Issues
Server Not Starting
If the server doesn’t start, check the logs for any startup errors:
fmsadmin get logs event
Make sure the server has access to all the necessary files and that there are no permission issues.
Backup Failures
If backups are failing, check the available disk space and ensure that the backup folder is correctly specified:
df -h
Also, ensure that the FileMaker Server has write permissions to the backup folder.
High Memory Usage
If FileMaker Server is consuming too much memory, check the cache size and consider lowering it:
fmsadmin get serverconfig cachesize
fmsadmin set serverconfig cachesize=1024
Conclusion
The FileMaker Server Command Line Interface is a powerful tool that provides administrators with granular control over the server environment. Whether you’re automating backups, adjusting configurations, or troubleshooting issues, the CLI gives you more flexibility and control than the Admin Console. By integrating the CLI into your daily workflow, you can improve server performance, streamline maintenance, and reduce downtime.
Be sure to experiment with different commands and explore how the CLI can enhance your FileMaker Server management processes!