I am trying to monitor a process on a PID or process, lets say mozilla-firefox, whatever. I would like to execute this at the command line where it would run every 15 minutes or so to give me an update on its progress. I have gotten this far but I am stuck with it not working.
[cuda@localhost ~]$ while loop
> do
> ps -ew | grep mozilla-firefox
>
>
> done
bash: loop: command not found
[cuda@localhost ~]$
Any ideas on how to make this work, I know it missing the time to repeat because I don't know what it is.
*nix - useing the DO statement
If the script is doing something completely automated and you don't need to watch it i'd recommend using the chronograph service (cron). Fully automatic execution at specified times or intervals without user intervention.
If you need to watch the script's output, use the \"watch\" program.
If you need to watch the script's output, use the \"watch\" program.
Code: Select all
watch -n 1 \"ps -ew | grep apache2\"
Are you trying to do an infinite loop? Try:
Code: Select all
while [ true ]
Re:
Jeff250 wrote:Are you trying to do an infinite loop? Try:Code: Select all
while [ true ]
Yes that's it woohoo, now I need to put a timer control on it. like making it run once or twice every 15 minutes to give me an update until the process quits.
You can put a delay in the loop with:
or something analogous. Look in sleep's man pages for usage.
Code: Select all
sleep 15m
yipper that's it, I just found it myself finally on Google.
Thanks alot for the assist, I am learning Perl scripts at work by being thrown into the fire. I did buy some books by Oreilly to help myself along but I am in the very beginning of learning. In a way this is so very cool and at the same time sucks.
Thanks alot for the assist, I am learning Perl scripts at work by being thrown into the fire. I did buy some books by Oreilly to help myself along but I am in the very beginning of learning. In a way this is so very cool and at the same time sucks.