3 Replies Latest reply on Apr 7, 2016 3:20 AM by beverly

    Simple way to schedule scripts to run on shared hosting when 'real' FMS schedules are unavailable

    skywillmott

      Hi all,

       

      Just thought I'd share this simple method I've found for scheduling scripts to run in solutions on shared hosting such as provided by the likes of triple8.net and fmphost.com

       

      In these circumstances it is not possible to set up native FileMaker Server scheduled scripts, so instead what I've been able to do is use the FileMaker PHP API to trigger scripts and then use a web service - cronless.com - to set up a schedule to load the php page that triggers the script to run...

       

      Very simple :-)

       

      The php script at it's most basic looks like:

       

      <?php

      include("FileMaker.php");

      $fm = new FileMaker("fileName", "serverAddress", "user", "password");

      $newPerformScript = $fm->newPerformScriptCommand('layoutName','scriptName');

      $scriptResult = $newPerformScript->execute();

      echo "done";

      ?>


      You just need to put this on your web server, along with the FileMaker PHP API files, and then go to cronless.com and set up a schedule to point to its URL, e.g. http://myserver.com/myphpscript.php


      Of course, you will likely need to consider security if you don't want the script to be openly trigger-able by anything visiting that URL, and perhaps use some kind of secret key sent to the php script over https in a similar way as other web service APIs work... e.g. the URL might be https://myserver.com/myphpscript.php?secretkey=asb3bjriewr4


      I'd be interested if anybody has any ideas on security in this setup....


      Anyway, works great :-)