2 Replies Latest reply on Sep 28, 2011 9:33 AM by philmodjunk

    Running a script on the server

    nolak37

      Title

      Running a script on the server

      Post

      I have 3 servers ser up at remote locations and want to do incremental backups, I created a script to do this.

      The script is a 2 part, the first goes theough every layout on both DB's and shows all records to ensure nothing gets skipped. Then the second part goes to the first layout and does an import records, no dialog "file"; update matching; windows ANSI. then sorts all records by ID and goes to last record and sets next serial number to this ID plus 1.

      This script continues going though all layouts inporting all records.

      Everything works as expected when I log onto the server and run it through filemaker however when I create a schedule to automatically run this every night it doesnt work, Gives me error codes 4, 5, and 100 and does not import anything.

      Anyone know what I might be doing wrong?

       

      Thanks

        • 1. Re: Running a script on the server
          Sorbsbuster

          "...then sorts all records by ID and goes to last record and sets next serial number to this ID plus 1" nothing wrong with that, but another way to do it, which I think is neater and less time-consuming as the file gets bigger, is to create a cartesian self-join for the table and have the last script step Reset Serial Values (That Field ; Max (SelfByConstant::ThatField ) + 1 )

          • 2. Re: Running a script on the server
            philmodjunk

            This script, as written, is not compatible with server scheduled scripts. Import Records is very limited when run from a server schedule.

            Here's a knowledge base article on the topic: http://help.filemaker.com/app/answers/detail/a_id/7035/kw/server%20import%20records

            Note that from a server schedule, you can only export to and import form text type files such as a tab or csv file and it must be in a specific folder on the server in order to work.

            We do this kind of script from a robot file to avoid these limitations. The robot file has a script set up in file options that runs when the file is opened. The script has just two lines:

            Perform Script [//specify script in hosted file that needs to be run to move the records]
            Exit Application

            The robot file is set up to open its self with an account name/password that is also defined in the hosted file so when it opens, it is able to connect to the the hosted file as a clieint, run the script and then shut down.

            We then use an OS based utility program to schedule that this file be opened at a specific time. Since we use Windows here, we use Windows Taskmanager to schedule that this robot file by "run" at a specified time. There are Mac OS equivalents to this scheduler that you can use on Mac systems.