|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Script for grepping status
I'm a newb so please be kind. I'm trying to write a script to check the status of a program running on a vncserver to know whether or not it has ended and if I need to restart the server. Here's what I've got and please I am a self taught scripter:
if [ ps ax | grep xterm | awk '{print $5}' = "xterm" ] then serv-restart fi I've been searching and am not quite sure how to make work. Any hints or pointers is extremely appreciated. |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
You can try : Code:
if ps -ef | grep -q 'pattern_to_srch' then echo "Available,"; else echo "Not available, do retsart" ...restart logic... fi |
| Sponsored Links | ||
|
|
|
#4
|
|||
|
|||
|
preliminary result are the pgrep will work perfectly. just have to do some testing. will let you know.
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to check status of a PID | zeekblack | Shell Programming and Scripting | 14 | 10-03-2006 03:09 PM |
| Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 | fishsponge | Red Hat | 5 | 07-14-2006 02:53 PM |
| CronTab script exit status 134 | VijayKumar | Shell Programming and Scripting | 3 | 03-24-2005 10:56 PM |
| status of perl script in another ... | jo_aze | Shell Programming and Scripting | 4 | 08-05-2003 08:19 AM |
| Couldn't open status file /var/samba/STATUS.LCK | macdonto | UNIX for Dummies Questions & Answers | 2 | 08-08-2001 08:42 AM |
|
|