Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: Creating PI...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 25 Topic 10992 of 11531
Post > Topic >>

Re: Creating PID file

by rob.dixon@[EMAIL PROTECTED] (Rob Dixon) Apr 28, 2008 at 06:48 AM

Michael Barnes wrote:
> 
> From: Jenda Krynicky [mailto:Jenda@[EMAIL PROTECTED]
>> 
>> Michael Barnes wrote:
>>>
>>> My apologies.  I know this is a cross-platform group, and that is
>>> fine.  However, if you are unable to understand simple Linux
>>> terminology, then it is doubtful that you can help answer my question.
>>>  If the description is nonsense to you, then please don't waste your
>>> or my time in an apparent slam on my choice of operating systems.  If
>>> your reply represents the general attitude of this list, then it looks
>>> like I've come to the wrong place for assistance. 
>>>
>>> But, to simplify my request, a pid is a process id.  In Linux, the
command 'ps' will give a listing of process IDs.
>>> I need the script to determine its own pid, then write that to a file.
>> 
>> I find THIS email pretty rude.
>> 
>> There is nothing inherently Unix specific about finding the process 
>> id, writing it into a file (in whatever format) and possibly deleting 
>> it when the script exits. If you said what you wanted to acomplish, 
>> you'd get a help much sooner. And where did you find any slam of your 
>> OS choice is beyond me.
>> 
>> If this is your general attitude in mailing lists I would not be 
>> surprised if you had to change lists quite often.
> 
> Interesting.  I post a question looking for assistance.  I am
> promptly chastised for my terminology, then told what I am trying to
> do is nonsense, and I'M the rude one?
> 
> Well, let's see.  In my original post, I said "I need to have my
> script create a pidfile." and "I need my script to create a pidfile
> when it starts."  That is what I need to accomplish. I thought it was
> pretty clear.

There is a long-standing philosophy in Perl culture that it should be as
platform-independent as possible. A lot of hard work has gone into making
things like multithreading work the same way everywhere, and such things
as file path separators are consistent and independent. However some
platform-specific features are inevitable, for instance if I need Perl to
manipulate the Windows registry then I have no choice but to say so.

It seems that all you required was for a Perl process to write its process
ID into a file. That is not a concept unique to Unix, and had you explained
things in that way you would have had a lot more group members on side and
willing to help.

> Instead of assistance, I'm told "your post is heavy with Unix
> terminology."  I guess that the terms "pid" "pidfile" and "ps" are
> only used by very deeply experienced Unix programmers.  But, Jenda
> says "There is nothing inherently Unix specific about finding the
> process id, writing it into a file", so it is unclear whether the
> terms "pid" "pidfile" are "heavy Unix terminology" or not.

I didn't say that you were using heavy Unix terminology, I said that your
post was heavy with such language. PID, pidfile and ps are Unix jargon for
simple concepts - they are just not called that (with the exception of PID)
outside Unix-like environments.

> As far as "where did you find any slam of your OS choice is beyond
> me", apparently you didn't read the posts very well.  First he says
> "your post is heavy with Unix terminology.", which tells me he
> believes I am using Unix (actually, I use Linux), then he says
> "'comparing the pid in the pidfile with ps' is nonsense."  So, I
> guess if he doesn't understand it, it is nonsense.

If you felt I was slamming your OS then your were being over-sensitive.
You still haven't explained where you found such an intention implied in
my post, and I can assure you that I didn't intend one. The terms you
used, I'm sure you'll agree, are common to most if not all Unix-like
systems. So while you may be using Linux I think it it is fair to say that
you were using Unix terminology in your post, as I was referring to your
language rather your installed software.

When I said that 'It does it by comparing the pid in the pidfile with ps'
was nonsense, I didn't mean that I couldn't understand your words. While I
spend more time programming Windows systems than Unix ones I still have a
good understanding of both. I meant that it was, simply, nonsense. All I
can think that that piece of English could mean is either

- Compare the PID to the ps utility

or

- Compare the PID (to something) using the ps utility

both of which are, as I said, nonsense. What you actually wanted was to
see if the process with the PID in the file was still running, and you
should have said so.
 
> If I saw a request for help that was obviously involving a
> programming language or OS I did not understand, I would simply
> ignore it and move on.  I certainly would not chastise the originator
> for using terms I personally do not understand, and I definitely
> would not refer to functions as nonsense just be cause I don't happen
> to be familiar with them.

I have already explained that you will get better help on this, and indeed
any group if you alienate as few members as possible. But it is also poor
programming practice to involve parts of an imagined solution in your
statement of a problem, as if you do you are immediately and
unintentionally restricting possible solutions. You didn't say whether or
not the process that was doing the monitoring was written in Perl. (If you
still have a choice, I would recommend that it should be, unless it
actually has to do a lot more than the monitoring you describe.) But
shelling out to the ps utility is a very awkward way of checking whether a
process is still running, and you could usefully investigate the Perl
kill() function as an alternative technique.

> I don't change lists very often.  I am a member of quite a few
> mailing lists.  But I have never been treated like this on any list
> before.  I guess my original assumption was right, "This may be a bit
> advanced for a beginner's group."

Your problem is trivial compared to many that are posed here. I am sorry
that you were upset by my reply, but I had no intention of being offensive
and I would suggest that you misinterpreted what I wrote. You are certainly
over-sensitive about being criticized for your choice of platform, as it is
hard to read that into my words.

If you choose to stay then we will to our best to help, but I hope your
will bear in mind at least the spirit of what I have written here. If you
go elsewhere for assistance then I wish you well.

Rob
 




 25 Posts in Topic:
Creating PID file
mbarnes@[EMAIL PROTECTED]  2008-04-26 20:30:17 
Re: Creating PID file
rob.dixon@[EMAIL PROTECTE  2008-04-27 02:49:47 
RE: Creating PID file
MBarnes@[EMAIL PROTECTED]  2008-04-26 23:49:23 
RE: Creating PID file
MBarnes@[EMAIL PROTECTED]  2008-04-27 17:24:54 
Re: Creating PID file
rob.dixon@[EMAIL PROTECTE  2008-04-28 06:48:29 
Re: Creating PID file
chas.owens@[EMAIL PROTECT  2008-04-27 04:53:22 
Re: Creating PID file
peng.kyo@[EMAIL PROTECTED  2008-04-27 16:59:52 
Re: Creating PID file
chas.owens@[EMAIL PROTECT  2008-04-27 05:03:56 
Re: Creating PID file
peng.kyo@[EMAIL PROTECTED  2008-04-27 09:50:51 
Re: Creating PID file
peng.kyo@[EMAIL PROTECTED  2008-04-27 10:36:11 
sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-26 23:24:22 
Re: sql and perl
orasnita@[EMAIL PROTECTED  2008-04-27 11:06:23 
Re: sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-27 12:25:59 
Re: sql and perl
rvtol+news@[EMAIL PROTECT  2008-04-28 09:54:43 
Re: sql and perl
rob.dixon@[EMAIL PROTECTE  2008-04-28 09:20:07 
Re: sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-28 10:19:51 
Re: sql and perl
peng.kyo@[EMAIL PROTECTED  2008-04-27 11:34:01 
Re: sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-26 23:42:24 
Re: Creating PID file
orasnita@[EMAIL PROTECTED  2008-04-27 10:56:58 
Re: sql and perl
dan@[EMAIL PROTECTED] (D  2008-04-28 18:15:36 
Re: sql and perl
ficovh@[EMAIL PROTECTED]   2008-04-28 10:40:29 
Re: sql and perl
rob.dixon@[EMAIL PROTECTE  2008-04-28 17:52:53 
RE: sql and perl
rvm@[EMAIL PROTECTED] (B  2008-04-28 14:40:25 
Re: sql and perl
rob.dixon@[EMAIL PROTECTE  2008-04-28 20:06:21 
RE: sql and perl
andrew.curry@[EMAIL PROTE  2008-04-29 00:09:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 1:03:46 CDT 2008.