script line not working properly

Hi ,
I am using the below command in script. $_IDLETIME is returning value if i execute the script manually.

sar > $_LOCATION/sar.txt

_IDLETIME=`tail -2 $_LOCATION/sar.txt | head -1 | tr -s ' ' ' ' | cut -d ' ' -f8 | cut -d '.' -f1`;

if [ $_IDLETIME -gt 60 ]

But it s not returning any value if it put the script in cron..

Any soluting for this...

Thanks,
Ahamed.

The usual problem with running things in cron is paths. You don't get all your usual PATH values set by default so it can't find things it can when running inside your shell. Try calling sar with its absolute path, /usr/sbin/sar or what have you.

Hi,
I am able to get the sar report. from the sar.txt i not able to get the value after using tail,cut etc command. I am able to see sar report in sar.txt

Ahamed.

Have you tried printing its value to see what has been assigned to it?