script not running in cronjob
set zar=0
set tot=0 for tot in 0 do while read i do cd /opt/audible/logs/cdl/$i d=`date|cut -d' ' -f1,2,3` e=`date|cut -d' ' -f4|cut -d':' -f1` f="$d $e:00" zar=`cat aws_dynamic_partial.log |grep "${f}"|cut -d' ' -f14 | tr -s ',' ' '` tot=`expr $tot + $zar` echo $tot > /home/dingale/file done done < serverlist.txt echo no of c programms running are $tot|mailx -s "No of c programmes running are $tot" dingale@domain.com This script runs fine when fired manually but gives blank value when run as cronjob. Thanks, Ingale D. N. |
You're not specifying the all important magic header in scripts that tell your shell what interpreter will be running the script.
In this case, your script seems to be a sh/bash like script so you need to insert the following to very 1st line: Code:
#!/bin/sh |
When run as a cronjob you need to ensure the paths are found in your script. The safest way to do this is to always specify the full path for each utility (eg /bin/grep instead of just grep)
Try this in your script and see if it helps? |
All times are GMT -5. The time now is 10:58 PM. |