Set Variable [$eventsFilePath; Value:"file:/Library/FileMaker Server/Logs/Event.log"]
Import Records [No dialog; "$eventsFilePath"; Add; Mac Roman]
FMS can only import from what is in its Documents folder (or the temporary path).
So you have to use a Server Script Sequence Schedule instead of a regular Script Schedule. Your sequence would use a shell script to copy the logs into the Docs folder, followed by your import script.
Now, I just have to figure out how to get that shell script to work from within the Sequence, as it throws "invalid account name or password" or "aborted; aborted by user" errors. I can run the shell script through the terminal, so now I'm working our the other problem: importing with PSoS between two hosted files.
- - Scott
Unless you've specified a user account, it will run as fmserver, so keep that in mind for whatever it needs to do. Just copying files should not be a problem.
Also, keep in mind that you should exit the shell script with an explicit exit status. A non-zero status will signal a failure and will prevent the FM script in the sequence from running.
Here's the basic code I saved as "01_copy_recursive.sh":
cp -R -p /Library/FileMaker\ Server/Logs /Library/FileMaker\ Server/Data/Documents/UploadTemp_FMSlogs
I've pasted those lines into the Terminal and it works every time I hit the return key.
So, I created a Shell script schedule in FMS 13 admin console to run once, just so I could see if it works there, before chaining it with my FM master script in a sequence. I did not specify a user account, but it throws the error "aboted by user" and does not work. If I change it user use the local user account on the computer hosting FMS, it throws the invalid user/password error.
I'm researching the OS X developer library to see what I can learn about Shell scripting.
- - Scott
It may help, but of course you'll have to embed this in an applescript due to the password (and then run the Applescript in command line)
To act as fmuser without knowing the pw:
- in a Terminal:
# going to root
# after entering pw
sudo -u fmserver /Library/FileMaker\ Server/Data/Scripts/touch.sh
That should execute the script as fmserver.
I would suggest setting up what is called a "service account" so you can assign it the proper privileges needed for just the task and use that one explicitly in the schedule.
I will look into your suggestion and the link on fmForums. Oh…I've been reading with keen interest the good questions you've been posting to the Performance Panel!
- - Scott
You're up early today! I had just such an account on my previous server (FMS12), so I will do he same here. Except for the Shell command in the script sequence, I was able to get all of the other things to work in importing from the log files, pasring, sorting, limiting the records based on Scriptparameter passed from client through PSoS, deleting records older than what is already in Target file, then importing sorted data from the xported .tab file.
I'll look at the AppleScript approach mentoned by Vincent_L for getting the Shell to run.
- - Scott
Also, you may consider, rather than server side commands, to use Goya BaseElement Plug-In 's BE_ExecuteSystemCommand*. I'm in the process of transitionning all my applescripts and command to it, with great result.
It works server side, and is able to run any command. Maybe you comand wil work as it is today, cause maybe it would run it as fmserver user.
* Be aware that it uses Bash as ashele ≠ from terminal, mostly ok by some problems arise with tabs, \t. And use absolute path, as the default folder is /. You'll find more in support forum of BaseElements