Jump to content

Time based function


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

Recommended Posts

How do I check the time on a frequent basis to run a script? I want to shift the application to single user for 1 hour during a scheduled nightly backup. But I don't see how to check the time without just making a loop that will tie up resources.

Link to comment
Share on other sites

Aloha, DonH! I have not used them but I believe there are also FM plug-ins that accomdate timed scripts. If you go Queue's route (I might), a lot will depend on the OS you use. There may be other resources that your OS has that might solve your problem, too, but they are obviously not cross-platform.

--ST

Link to comment
Share on other sites

I'm assuming you're not using FM Server. If that's the case, then you would have to already be the host with the dbs up and running. Your scheduler would launch an FM file that called a script in the main file to Close each db. Then the launcher file would Close the main db, Loop until not PatternCount( DatabaseNames, "yourmainfile" ), then Open the main db (with the main db set to Open the other files on open) and call the script to run your backup.

I haven't done it, but it sounds like it would work. I would test it several times with guests connected before you actually run the backup portion.

Link to comment
Share on other sites

Yep. FM Server is shut down during this whole process. That is what is going on. The nightly backup. To backup the dbs the server must be shut down. So the users want a single copy running on a computer just to pull data from it while the main application is down.

So what I need to do is somehow have a script that will put that copy into single user when they open it. Since a new copy would be sent to the station every day, the script has to be embedded in the main app also. Thus I need it to be time based. Unless there is a way for FM to detect the local IP address. Then I could just have it look at the local IP address and put it in single user anytime it is opened on that machine.

So can FM detect the IP address?

Link to comment
Share on other sites

Okay, then, you shouldn't need to shut FM Server down to back up. Just use its back up feature, which pauses all files and performs a backup... Unless, of course, 4 doesn't have this feature.

Link to comment
Share on other sites

FM3 doesn't have that feature. Well, you can pause it but then the users are unable to even view files. They just get the coffee cup.

I'm getting there tho. I now check to see when the user logs on. If it is during the time the server is shut down, then they get the local version in single mode.

Now how do I call a specific script from outside FM so I can use the OS scheduler to shift them back to the full version?

Say I have a script called "shiftToFull" on a db called "myDB". How would I call that from outside FM?

Link to comment
Share on other sites

If it's at night and the users are aware of a backup being performed, I don't see why a coffee cup should be an issue. There shouldn't be a need to complicate it; just schedule the backup and let it do its thing. Afterward, it will return control to any logged in users.

The local version in single-user mode sounds very scary. I wouldn't encourage or endorse such a setup. They should just be patient while the backup completes. Having two FM files with the same name on a network is a very big no-no, and I'm assuming this is how you would accomplish the 'local version' scenario.

Link to comment
Share on other sites

sigh

You and I know they should be patient, but the patients don't know that. This for Labor And Delivery and those babies don't wait for the backup to finish. Now the doctors have been living with the situation of not having access to the records during the backup for about 2 years and they said "ENOUGH!" So yes, the coffee cup is an issue. They must have access to the files while the backup is in progress.

I think if I can call a script from an external dos command I can get this to work. Because, as you said, I do NOT want this running on the local machine once the server comes back up. So I can block it from running but once it is running I need to be able to kill it just before the server comes back online.

The easiest way to do this would be to just call a script that exits the application. BUT I need a way to know what time it is to be able to do that. It would appear only the schedule feature will let me do it. So now I need to figure out how to call that script from outside.

Link to comment
Share on other sites

So you have to boot all users from Server, open local files when they next try to log in, then boot each from his local files and reopen the files on Server. How do you update Server files with information that may have been added/deleted/modified during the update? I'm assuming the local files have different names than the ones hosted by Server. If not, this is asking for trouble.

I haven't had experience with this type of situation, so someone else may have a cleaner process. If you are tracking the time in a WinBatch or a similar batch file, I think you would have it open another FM file with an on open script to close all open dbs (if any) besides the current one, and then open the main file on Server and close the interim file.

Your users still have to deal with this flip-flopping of files and will still be inconvenienced, just for not as long. I think you would need to import all the modifications before closing the local file or else there would be data missing when they logged back into the Server dbs. So I would reorder the on open script to open the Server files, import, then close the local files. In this case, they would most certainly have to be named differently or chaos would ensue.

Link to comment
Share on other sites

This all started when the entire network went down (scheduled) and I put the files on a single machine so they could retrieve data. Now they think it can be done all the time.

Of course it is asking for trouble but try explaining that to end users who don't want to hear "it can't be done". They know that they will not be able to add or change data while in the "local" mode because all changes will be lost.

Just another example of how difficult FM is to use. Hopefully this is fixed in 7.

Link to comment
Share on other sites

You might consider putting the data online either using the Web Companion or exporting the data to tab files and importing to MySQL tables or something similar. We do the latter and use php to present the static data without having FM open.

Link to comment
Share on other sites

I wish! Actually originally I was brought in to do exactly that. Get rid of FM and move to Cold Fusion. Got it about 1/3 done and some high mucky muck decided to go with a .Net solution instead. Still waiting for that one to appear.

But that, too, is not an option unfortunately.

Link to comment
Share on other sites

AH HA! I knew if I whined and groveled and begged and talked common sense long enough a solution would come out. Suddenly they have a laptop I can load the application onto which would be unplugged from the network except to download the updates everyday.

whew

Link to comment
Share on other sites

This topic is 7213 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.