On Tue, 18 Jun 2002, Richard Bonebrake wrote:
>
> >Jeferson Lopes Zacco wrote:
> >>I believe your solution will also remove a valid lockfile, ain't it?
> >
> >actually because it's specific to the file you're looking for "it" is only
> >looking for a file which is so named in the variable. If that variable
> >happens to be a lock file and there is no process running then wouldn't
> >you "want" to remove the lockfile.
> >
> >if you're concerned about removing a lockfile which is legal while a
> >process is running then check for the process at the beginning of the
> >script and if it is found then you can terminate the program, else, allow
> >the program to complete.
> >
> >Mark
>
> I sent this the other day, maybe no one saw it. Anyway any help on a script
> like this would really help.
>
>
> How do I do this? Can you give me an example of the script. Thanks
>
>
>
> Richard D. Bonebrake
> Asquith Internet
> [EMAIL PROTECTED]
>
Hi Richard,
Actually I did see your post and responded to it, but the list(s) seem to
be experiencing some "growing" pains again and the message went haplessly
into the ether.
At any rate, when I saw your post asking this question the other day I
started hacking away at it. since this is "my" first time at checking for
a running process via a shell script we're somewhat in the same boat. I
was about half way there when I got side-tracked by a few things that have
held my attention since then.
If you don't mind learning it together we can continue this, unless of
course someone more knowledgeable in shell scripting chooses to supply the
concise answer to this question. We can also of course do this on or off
list. either way is fine with me. I personally would prefer to do it
onlist so that it's in the archives for others to access, however some may
prefer that since it's not directly "on-topic" with this mailing list
that the thread be taken off-list.
since we already know "how" to check for the existence of the .lock file
itself all we need to do now is check for a running process. With that in
mind this is where I'm currently at with this:
#####################################
# detecting the running process
#####################################
proc=`ps r|grep <process-name>` # the "apostrophe" looking character is
# NOT an apostrophe and is necessary
# for the entire command with arguments
# to be loaded into the variable
As soon as I get a chance I'll intend to workout just how to get the
results of $proc into another variable so that you can run a "kill"
command on the pid that is returned "if" the process exists.
--
daRmaTTeR
R L U: #186492
When ever people annoy me I remember, "Vengence is mine saith the Lord."
My prayer is, "...here am I Lord...send me!"
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com