|
Author |
Message |
kepler
Junior WebHelper
![Junior WebHelper Junior WebHelper](images/rank_1.gif)
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Fri Nov 05, 2004 3:57 pm (19 years, 5 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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 |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by kepler Find all posts by kepler](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Daniel
Team Member
![](images/rank_6.gif)
![](http://www.4webhelp.net/forums/images/daniel_avatar.php)
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Fri Nov 05, 2004 4:59 pm (19 years, 5 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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](/forums/images/smilies/icon_sad.gif) |
________________________________
![Image Image](http://www.4webhelp.net/images/daniel_sig.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Daniel Find all posts by Daniel](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
adam
Forum Moderator & Developer
![](images/rank_6.gif)
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Sun Nov 14, 2004 7:14 pm (19 years, 5 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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... |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by adam Find all posts by adam](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
kepler
Junior WebHelper
![Junior WebHelper Junior WebHelper](images/rank_1.gif)
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Sun Nov 14, 2004 7:28 pm (19 years, 5 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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 |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by kepler Find all posts by kepler](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
|
|
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.117592 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |