Sponsored Content
Top Forums Shell Programming and Scripting Why do I need this in the script tutorial? Post 302529985 by alister on Saturday 11th of June 2011 09:22:25 PM
Old 06-11-2011
Quote:
Originally Posted by redhead
which is exactly why it is extensively used in combination with grep, in order to make it work no matter what teh underlying system supports in the ps command.
It may work, mostly, regardless of the underlying system, but it's not a robust solution. False positives remain a possibility and could result in killing the wrong process or mistakenly concluding that a dead process is still running.

A few years ago I helped someone troubleshoot an intermittent failure which I found to be caused by grepping ps output for a short command name which sometimes occured as a substring in a related command's arguments.

You could improve the situation by tightening up the regular expression a bit, or perhaps using AWK to search for the term in a specific field, but at that point you may be depending on non-portable output format characteristics. May as well make life easier and just use the non-portable ps options.

For this task, I'm not sure you can achieve portability and correctness using ps. I think with pgrep you can, but I haven't taken a close look at many pgrep implementations. That said, I realize that many systems and tasks are not mission critical, and so an 80% solution is often sufficient.

PID files? Mostly useless and racy.


Quote:
Originally Posted by William Wallace -- Scottish Sysadmin
"They may take our lives, but they'll never take... OUR P{GREP,KILL}!!!"
Okay, maybe I went a little off the rails there. Smilie

Regards,
Alister
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Procmail Tutorial

Hello, Somebody knows a good procmail tutorial in the net? Thanks!:) (1 Reply)
Discussion started by: luiz_fer10
1 Replies

2. UNIX for Dummies Questions & Answers

Unix Tutorial

Any good UNIX tutorials to download? Any good APACHE tutorials? thanks (2 Replies)
Discussion started by: TEKGALAHAD
2 Replies

3. Shell Programming and Scripting

Tk tutorial

Anyone know any good website with a step by step instructions on writing Perl GUI scripts with Tk ??? (3 Replies)
Discussion started by: perleo
3 Replies

4. Post Here to Contact Site Administrators and Moderators

Tutorial forum?

I got this account a while ago and didn't have much time to try it out. After having had some frustration by posting tutorials regarding various Linux activites of mine in my Slashdot journals, it occurred to me that this forum might be better suited. I know I can probably post in the OS specific... (1 Reply)
Discussion started by: deckard
1 Replies

5. IP Networking

RouterSim tutorial.

Hi everyone... Well, this is a kina of help tutorial question. I'm using actually the “RouterSim Network Visualizer” an environment where you can practice and create your own LAN, I will be honest, I'm new to creating and managing networks, but not to new about IP´s. So, the question, anyone... (0 Replies)
Discussion started by: TARFU
0 Replies

6. Shell Programming and Scripting

Shell script tutorial?

Hi All, I have started preparation of Shell script...Can anybody send me the link where I can get a right tutorial or pdf file of shell script... Thanks in Advance (2 Replies)
Discussion started by: kunalpatil09
2 Replies

7. AIX

AIX useful tutorial...

hi guys, I want to learn AIX, I am a beginner for this operating system of IBM. Can anyone give me some useful tutorial for a beginner like me?... Thanks... + GOD bless + ^_^ (1 Reply)
Discussion started by: TechReader
1 Replies

8. Solaris

Need LAMP tutorial!

Hello Everybody, Does anybody know or recommend me a tutorial for LAMP server on Solaris 10 x86? (3 Replies)
Discussion started by: ahmedamer12
3 Replies

9. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series: ... (0 Replies)
Discussion started by: Neo
0 Replies
ppmtopgm(1)                                                   General Commands Manual                                                  ppmtopgm(1)

NAME
ppmtopgm - convert a portable pixmap into a portable graymap SYNOPSIS
ppmtopgm [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces a portable graymap as output. The output is a "black and white" rendering of the original image, as in a black and white photograph. The quantization formula used is .299 r + .587 g + .114 b. Note that although there is a pgmtoppm program, it is not necessary for simple conversions from pgm to ppm , because any ppm program can read pgm (and pbm ) files automatically. pgmtoppm is for colorizing a pgm file. Also, see ppmtorgb3 for a different way of converting color to gray. And ppmdist generates a grayscale image from a color image, but in a way that makes it easy to differentiate the original colors, not necessarily a way that looks like a black and white photograph. QUOTE
Cold-hearted orb that rules the night Removes the colors from our sight Red is gray, and yellow white But we decide which is right And which is a quantization error. SEE ALSO
pgmtoppm(1),ppmtorgb3(1),rgb3toppm(1),ppmdist(1),ppm(5),pgm(5) AUTHOR
Copyright (C) 1989 by Jef Poskanzer. 10 April 2000 ppmtopgm(1)
All times are GMT -4. The time now is 11:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy