Monitoring scripts
Are there any built in commands that allow me to monitor when how often a script runs? I have an application and when that application is accessed there is a script that runs. We were looking to monitor how often it runs and how much %CPU and %MEM the script was taking up on average.
Thanks |
There aren't really any built-ins for doing what you're asking; however, it's quite simple to append information to a log file, say insert this in your progam
Code:
who am i >> /var/log/script.log How much memory and CPU it takes, well, I dunno. You can look at sysstat, mpstat, sar, ps and maybe top (piped through grep and appended to a log file. Hope this helps some. |
Quote:
who am i | top | grep [program_name] >> /var/log/script.log? EDIT: Never Mind; I figured it out. Thanks again!! who am i; top | grep [program_name] >> /var/log/script.log |
Quote:
Quote:
- What is the application? Just tell us the name OK? - How or when is the application run? On local user login, command line, via CGI, cron job, when the Three Horsemen of the Apocalypse enter the bar, etc, etc? - Does the script run a for a very short period of time? - Does it run independent of the application or does the application run it? - Who does the script run as? - Does it access different resources during its run? - Can you modify the script? ...and all of these matter. The more we know about the application and its relation to the script the easier it will be to come up with a way less kludgy solution. |
Uh, not to be contrary, but
Code:
fubar-trona-/home/trona: who am i Code:
man who |
I've used "who loves you" for a couple of years now.
|
Quote:
|
All times are GMT -5. The time now is 03:02 PM. |