Actively watching for running processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Actively watching for running processes
# 1  
Old 04-06-2004
Question Actively watching for running processes

Here's a fun one...

What's the best way to script looking for a process when it runs? For example, what if a process is running that's been set up graphically, which you would like the entire command line string for? Say it's rpm for the sake of having a command to use as an example. You want to know what some utility is running with 'rpm -options'. How can you do a 'ps aux | grep rpm' and have it watch actively for an extended period of time for the command to occur?

Smilie
# 2  
Old 04-06-2004
do it in a loop?

while true
do
ps -aux | grep rpm | grep -v grep
sleep 1
done

Thats a basic idea, but you can elaborate with logging to a file for example.
# 3  
Old 04-07-2004
Quote:
Originally posted by mbb
do it in a loop?

while true
do
ps -aux | grep rpm | grep -v grep
sleep 1
done

Thats a basic idea, but you can elaborate with logging to a file for example.
That works wonderfully. Thank you very much. Smilie

*takes the simple piece of code and make it unecessarily long and redudant* Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Many processes running at the same time

Hello everybody , I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!! My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Discussion started by: beautymind
14 Replies

2. Shell Programming and Scripting

Check Running Processes

I want to check how many processes are running with same names and get their respective counts. ps -ef|grep -Eo 'process1|process2|process3| '|sort -u | awk '{print $2": "$1}' Output would look like : $ ps -ef|grep -Eo 'process1|process2|process3| '|sort | uniq -c | awk '{print $2":... (8 Replies)
Discussion started by: simpltyansh
8 Replies

3. Solaris

Sendmail processes not running

Hi All! I am trying to get sendmail to work but unsuccessfull...when I run ps -ef | grep sendmail root 10578 10561 0 11:01:24 pts/1 0:00 grep sendmail I do not see its processes When I run the following commands: bash-3.00# svcs sendmail svcs: Pattern 'sendmail' doesn't match... (9 Replies)
Discussion started by: fretagi
9 Replies

4. Linux

Running processes

Hi guys is it normal to have 5-10 cron/syslog processes running... in my case i got 10 cron process running. (4 Replies)
Discussion started by: batas
4 Replies

5. Solaris

Running processes on GZ/LZ

Hi guys just a question is it normal to see running process on a non-global zone in the global zone... processes such as cron. (3 Replies)
Discussion started by: batas
3 Replies

6. Shell Programming and Scripting

how to know the running processes.

Hi can anybody help me regarding this.. i want know the output of ps -ef with explanation. how can we know the running processess. this is the output of ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 19 T root 0 0 0 0 SY ... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

7. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (2 Replies)
Discussion started by: Ikebana
2 Replies

8. UNIX for Dummies Questions & Answers

identifying running processes

how to identify the processes running by giving the parent process id (1 Reply)
Discussion started by: trichyselva
1 Replies

9. UNIX for Advanced & Expert Users

running processes with no hang up

Can we run a script in nohup which calls another script in nohup. eg Script1.sh #Script1 start nohup script2.sh . . . #end script1.sh Now can I do this nohup script1.sh Also is all scheduled processes (crontab entries) will run as nohup? Would appreciate if any one can... (3 Replies)
Discussion started by: yakyaj
3 Replies

10. HP-UX

how to check whether a script is running actively or hanged/ in deadlock)

Hi I have a doubt regarding process states in HP unix system. Is there a way to check whether a process is hanged or still actively running? I have few scripts which run for a long time. but sometimes these are getting hanged. But i'm never sure whether they are running or waiting in kind of... (4 Replies)
Discussion started by: truth
4 Replies
Login or Register to Ask a Question