Stopping a command in between


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stopping a command in between
# 1  
Old 01-11-2007
Stopping a command in between

Hi
Is it possible to stop a command executing after certain time?
I have this command say prstat which keeps on giving the values etc of the processes after every 1 sec(refreshes the screen)
What I want is just stop the execution after first screen

Since I have written this command in shell script, I am not sure how I can stop it so that my script continues on the next line(right now it keeps on waiting for the output of this command)
Can someone help?

San
# 2  
Old 01-11-2007
Try 'prstat 1 1'. This will run prstat just once and then quit.
# 3  
Old 01-11-2007
Thanks
Can you explain what does 1 1 do?
# 4  
Old 01-11-2007
From the man page of prstat:
Code:
[interval [count]]

The interval and the count is at the end of the command. It means that prstat has to be run at intervals of 'interval' seconds and 'count' number of times. So prstat 1 1 runs the command at one second intervals and runs it just once.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Stopping cron job

Hi, I have scheduled one job in crontab. I want to stop the job automatically after some time of its execution without killing it. Could i archive the above? (8 Replies)
Discussion started by: mehulleo
8 Replies

2. UNIX for Advanced & Expert Users

Stopping SSH tunnel

I have initiated a tunnel for vncserver. now i want to stop it. is there any way except sleep option? (2 Replies)
Discussion started by: majid.merkava
2 Replies

3. Red Hat

stopping you have mail.....

Hi, on server Red Hat Enterprise Linux AS release 3, I am getting the mail "you have mail" can any body suggest how to stop this? mail are getting generated in below path. /var/spool/postfix/maildrop, due to which heavy file are getting generated. though sendmail service is stopped. ... (0 Replies)
Discussion started by: manoj.solaris
0 Replies

4. UNIX for Dummies Questions & Answers

Stopping a shell script

This is simple for an experianced scripter but that is not what I am :) if ; then echo -==Test Passed $3 $4==- >> $1$2 nohup $6$7 & >> $1$2 else echo -==$8==- >> $1$9 echo -==$8==- >> $1$2 fi In the else step I also want to stop the script from moving on. ... (15 Replies)
Discussion started by: jadionne
15 Replies

5. Shell Programming and Scripting

Stopping A process

Hi I want to stop a process using a shell script. how do i do that? ie, to simulate ps -ef|grep Process name get the process id and kill -9 process id plz help... (4 Replies)
Discussion started by: gopsman
4 Replies

6. UNIX for Dummies Questions & Answers

Stopping a command during the cycle

Hi, Two things really: 1) can you input a code to pause a program until a key is pressed? 2) can you stop a command during a cycle? (7 Replies)
Discussion started by: chapmana
7 Replies

7. UNIX for Advanced & Expert Users

stopping a processor

hi, Can any plz tell what is the command for stopping a processor? suppose a system is accessing 10 processors and we want to stop the 3rd & 6th processor then whats the command in Unix? thank u (2 Replies)
Discussion started by: nm_virtual
2 Replies

8. Shell Programming and Scripting

stopping a script

i want to stop a script from running after one minute, using the sleep command, and then kill the process. anyhelp with this. (2 Replies)
Discussion started by: AtomJ22
2 Replies

9. UNIX for Advanced & Expert Users

Stopping a print request

Im running a solaris 9 system and keep getting this message: Request to LXKF894CB (unknown printer) from zion. This happen because there was a mis configured printer and a job was submitted to it. I fix the printer issue but this message keeps repeating and the PID keeps going up. How can i... (5 Replies)
Discussion started by: meyersp
5 Replies
Login or Register to Ask a Question