beezwax / filemaker-facter

Facter custom facts for reporting FileMaker Server statistics & status
MIT License
6 stars 0 forks source link

file names online fact #19

Closed sibrcode closed 5 years ago

sibrcode commented 5 years ago

Need a fact to list the file names (including paths?) of the currently hosted files.

sibrcode commented 5 years ago

We can't easily use fmsadmin list files command, because that requires authentication.

For macOS we can use the lsof command to list the .fmp12 files that are open:

lsof -Fn | cut -c2-| grep ".fmp12$"

But we should use the -p option to restrict to just the fmserverd process. Sticky point though is that macOS does have the pidof command.

sibrcode commented 5 years ago

Aha, we can use pgrep.

So a complete shell command is:

/usr/sbin/lsof -Fn -p `/usr/bin/pgrep fmserverd` | /usr/bin/cut -c2-| /usr/bin/grep ".fmp12$" | /usr/bin/sort

sibrcode commented 5 years ago

filemaker_open_files.rb added.