?
Solved

Lock out other users of script

Posted on 1998-10-19
8
Medium Priority
?
173 Views
Last Modified: 2010-03-05
I have a script called by form on html.  I would like to lock out any other user from accessing that script while another person is accessing it.  I have flock on the files, but need to lock out the whole script when in use.  Perl is running on a unix system.
0
Comment
Question by:Lee5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1205511
Doesn't a flock at the start of your script do what you want?
0
 

Author Comment

by:Lee5
ID: 1205512
ozo
It is my understanding that flock only works on open files.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1205513
yes, can't you open a file?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Lee5
ID: 1205514
  yes, but as soon as I close the file the flock leaves.  I also understand that flock is only for that file.  Some of my scripts open and close several files, sometimes a couple of times.  If one person starts a sequence and another can come and operate on the same variables, it could cause a mess.
I am looking for a way to prevent someone from accessing the script if it is being used.  
    I guess I could have a fake file that is opened and flocked at the beginning of the script and then closed at the end.  If the file is not accessible, it could send a message to try later.   Is that what you had in mind?
    If that is so, just make it an answer to my question.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1205515
So, don't close the file until the script is done.
Or don't close the file at all, and let it unlock when the script exits.
0
 

Author Comment

by:Lee5
ID: 1205516
ozo
make it an answer
Thanks,
0
 
LVL 84

Accepted Solution

by:
ozo earned 200 total points
ID: 1205517
Just keep an exclusive flock on a file over the entire script.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1205518
You may want to make it a LOCK_NB, so you can test it and give an error message, instead of making the user wait.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question