4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Logout before time
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Fri Nov 05, 2004 3:57 pm (19 years, 5 months ago) Reply with QuoteBack to Top

Hi,

I've made a script that due to the fact that its too heavy ( as an application ), I was forced to gather it with a executable, and, in order to be one single person accessing it at the time, I made a little script: if the person is using it, the program writes the word "busy" to a file; in this case if someone else tryes to access it, if the file is written it tells him to wait 30 seconds. After the job done, the file is truncated.
It works well. But there's a problem: what if the person that's using it change of page or stops the script? The file is written and nobody else can access it.

Do you understand my dilema?

Any ideas?

Regards,

Kepler
OfflineView User's ProfileFind all posts by keplerSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Fri Nov 05, 2004 4:59 pm (19 years, 5 months ago) Reply with QuoteBack to Top

What about using a timestamp instead of just the word "busy"? Therefore if the timestamp is too long ago (say 30 seconds), then you act as though the file wasn't busy. Sorry, won't be able to help you with any of the code though Sad

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Sun Nov 14, 2004 7:14 pm (19 years, 5 months ago) Reply with QuoteBack to Top

Perhaps a better way would be to avoid relying on a lockfile and instead just check to see if the program is running. You could do this by simply checking the output of pidof.

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Sun Nov 14, 2004 7:28 pm (19 years, 5 months ago) Reply with QuoteBack to Top

Hi,

I'm glad to see you around here again. I solved the problem with a file; when it's busy, its written with the actual value of time ( in seconds ). Other user that tryes to came in, only enters if the file is empty or the difference in seconds between the entry and the file value is greater than 60 secondes. Meanwhile if the main user leaves the page in the middle of the operation, there's no problem. But I'll study - with time - what you suggest.

Kind regards,

Kepler
OfflineView User's ProfileFind all posts by keplerSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.136846 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme