Oct 11, 2005 #1 kanghao IS-IT--Management Jul 4, 2004 68 KR How can I run some commands repeatedly? for example I want to print "ps -ef | grep Exus | wc -l" the below won't work. while true do "ps -ef | grep Exus | wc -l ;sleep 1" done; Thanks.
How can I run some commands repeatedly? for example I want to print "ps -ef | grep Exus | wc -l" the below won't work. while true do "ps -ef | grep Exus | wc -l ;sleep 1" done; Thanks.
Oct 11, 2005 #2 KenCunningham Technical User Mar 20, 2001 8,475 GB Put a ; after while true and lose the quotes. Upvote 0 Downvote
Oct 11, 2005 #3 KenCunningham Technical User Mar 20, 2001 8,475 GB Sorry - put a ; after the sleep too Upvote 0 Downvote
Oct 11, 2005 #4 marrow Technical User Jul 20, 2001 425 US while true do ps -ef | grep Exus | wc -l sleep 1 done Please try it this way Upvote 0 Downvote
Oct 18, 2005 Thread starter #5 kanghao IS-IT--Management Jul 4, 2004 68 KR Thanks. finally it works. while true; do ps -ef | grep Exus | wc -l; sleep 1; done; Upvote 0 Downvote
Oct 24, 2005 Thread starter #6 kanghao IS-IT--Management Jul 4, 2004 68 KR How can I add the time excuted? like 2005/10/10 18:07:19 3 (time, number of processes) Upvote 0 Downvote
Oct 24, 2005 #7 marrow Technical User Jul 20, 2001 425 US while true; do ps -ef | grep Exus | wc -l; sleep 1;date;done; Upvote 0 Downvote
Oct 24, 2005 Thread starter #8 kanghao IS-IT--Management Jul 4, 2004 68 KR I mean concatenate the process number and date in one line. like 2005/10/10 18:07:19 => 3 2005/10/10 18:07:29 => 2 Upvote 0 Downvote
I mean concatenate the process number and date in one line. like 2005/10/10 18:07:19 => 3 2005/10/10 18:07:29 => 2
Oct 25, 2005 #9 marrow Technical User Jul 20, 2001 425 US while true; do ps -ef | grep Exus | echo `date` = `wc -l`; sleep 1;done; Upvote 0 Downvote