![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to check the FTP Status? | smc3 | Shell Programming and Scripting | 1 | 06-24-2008 06:15 PM |
| Start time/end time and status of crontab job | thambi | Shell Programming and Scripting | 3 | 05-16-2007 11:24 AM |
| check the status and send an email with status | isingh786 | Shell Programming and Scripting | 3 | 12-29-2005 07:22 PM |
| performing a task at regular intervals | mridula | High Level Programming | 2 | 11-14-2005 05:26 AM |
| mailing myself at regular intervals... | timepassman | Shell Programming and Scripting | 4 | 08-21-2005 09:11 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I want to check process status at regular interval of time ...
so i ha wirtten this BUT its not working when i placed this peace of code in .sh .. please help me out #!/bin/sh w = ps -ef|grep processname | wc - l echo $w if [ $w -lt 3 ] ; then Banner "Proceesname Problem" else Banner " Running Fine" fi Please help me out with necessary modification . Thanks in advance... |
|
||||
|
hi jim,
Thank you very much, I got the solution and the problem is when we are trying taking variable "w" it is giving some errors i think "w" is internal system parameter . I tried it with taking "t" as variable it got executed. Thank you once again for helping me out JIM. Lastly i have one dought "ps -ef|grep $processname | grep-v 'grep' | wc - l" why did you grep -v 'grep' i havent used like this any time. |
|
||||
|
Hi Srini,
grep -v 'grep' would tend to filter the process output, not to include grep process.. Remember that it may be included as a process, and would confusions. So to be safe, that was added... Quote:
|
|
||||
|
Quote:
Code:
#!/bin/sh
if [ $(pgrep -c processname) -lt 3 ] ; then
echo "$processname Problem"
else
echo " Running Fine"
fi
|
|
||||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|