in reply to Performance issues

Problem with using sar is that it measures the whole system, and what it produces probably won't help too much. strace -f -c scriptnamemight help to identify the nature of the bottleneck - in particular the number of forks, but (again) that may be down to the called script.

Off subject: ls(1) is not needed:
for f in `ls /var/lib/amavis/virusmails/spam*.gz`
is better written as:
for f in /var/lib/amavis/virusmails/spam*.gz
but that won't help your performance problem.

Replies are listed 'Best First'.
Re^2: Performance issues
by spmlingam (Scribe) on Nov 29, 2008 at 05:40 UTC
    You can use this idea:

    First convert your bash script into Perl script, keep the process id of this script in to a file.

    Write another perl script with modules Proc::ProcessTable::Process & Sys::Info::Device::CPU

    Here you can get the CPU consumption of first script using the process id of the above script.

    You can issue stop and continue from this script to the first script based on the CPU load