Jump to content

Run Schedule using Applescript


This topic is 6662 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Thanks for the ChronTab tip, but that's not the problem.

When I try to open the AppleScript Dictionary for FM Server 5.5, the application is greyed out (running or not). Does that mean it is not scriptable? Also, during recording in Script Editor, no code is written.

Link to comment
Share on other sites

I think you can get away with just backing up the files.

Not sure, but you may need to close down the databases, and quit the app before backing up the files.

Since FMS is not AppleScriptable, you won't be able to do much to automate the backup schedule set.

Since I don't have FMS5.5 you will have to do some testing to see what is required to do a proper backup, and don't forget to test the restore process once you have a solution.

I also happened upon this pdf: http://www.filemaker.com/downloads/pdf/whitepaper_fms_linux.pdf

On page 12 is the following backup script - which is for linux, but may be able to be adapted for 10.3:

#!/bin/sh

# This script will pause the FileMaker Server and backup all files in the /var/fmserver

# directory to the /home/fmserver/backup directory.

fmserverd PAUSE

# pause the FM Server

cp –Rf /var/fmserver /home/fmserver/backup

# copies the entire directory structure,forcing existing data in /home... to be overwritten

fmserverd RESUME

# resume the FM Server

#!/bin/sh

# This script will restart the FileMaker Server daemon

/etc/init.d/fmserverd restart

# restarts the daemon

# causes the FM Server to reload all of the files in the /var/fmserver directory

This url may be useful as well: http://www.macosxhints.com/article.php?story=20011106164127927

Cheers-

Link to comment
Share on other sites

I think this will work for ya. Since you will have to shut down the FMS before you can make any copy or back up.

tell application "Finder"

set theList to name of (every application process)

if "FileMaker Server Config" is not in theList then

tell application "FileMaker Server Config" to activate

delay 10

set serverRunning to true

end if

end tell

tell application "System Events"

tell process "FileMaker Server Config"

set frontmost to true

tell window "FileMaker Server"

if exists button "Stop Server" then

click button "Stop Server"

repeat until value of static text 1 = "FileMaker Server is stopped"

delay 10

end repeat

end if

set serverRunning to false

end tell

end tell

end tell

tell application "Finder"

--Making archive copies

do shell script "your path to the shell script"

delay 2

end tell

on check_filemaker()

tell application "Finder"

set test to true

set theList to name of (every application process)

if "FileMaker Developer" is not in theList then

set test to false

end if

end tell

return test

end check_filemaker

set Start_FMServer to "Disk2:FMPProjects:GAT:Scripts:AppleScripts:StartFM_Server.app" as string

set FMRunning to check_filemaker()

if FMRunning is true then

repeat until FMRunning is false

delay 5

set FMRunning to check_filemaker()

end repeat

-- start up FM Server Config

tell application "Finder"

set theList to name of (every application process)

if "FileMaker Server Config" is not in theList then

tell application "FileMaker Server Config" to activate

delay 2

set serverRunning to false

end if

end tell

tell application "System Events"

tell process "FileMaker Server Config"

set frontmost to true

tell window "FileMaker Server"

if exists button "Start Server" then

click button "Start Server"

repeat until value of static text 1 = "FileMaker Server is running"

delay 2

end repeat

end if

set serverRunning to true

end tell

end tell

end tell

-------------------------

You will need this shell script also:

#!/bin/tcsh

# Tests if file exists. true = copy file

# syntax: if( -e file to check) mv "source location" "destination location"

# add more line if needed

if(-e "/Folder1/Folder2/yourDB") cp "/Folder1/Folder2/yourDB" "/YourArchiveFolder/YourDB"

---------------------------

Good Luck

Link to comment
Share on other sites

I would be very careful with the Thanh's approach. GUI AS will occasionally fail. If the config closes prior to the closing of the files being served by the server daemon, you could end up with corrupted files.

xyz's approach is better, but I have never got the shell scripting down very well.

I never stop serving my files, except once or twice a year to update system or server software. For back up I have a script that runs every hour. At the end of the day will move these files to a removeable drive using AS. Is the most reliable and eliminates need to start and stop FMS.

Link to comment
Share on other sites

This topic is 6662 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.