I have a script-I which calls another script-II and then parses a file and results in a '.csv' file.
script-I (keyword_misses) runs from the 'cron'. The cron entry is:
20 19 * * 00 /opt/TradeOne/bin/keyword_misses >> /var/TradeOne/logs/keyword_misses.out 2>&1
keyword_misses (script code):
#!/usr/bin/ksh -p
#. $HOME/.profile
logs=/var/TradeOne/logs
grep 'NO KEYWORD MATCH' $logs/docdetermination.new >> $logs/NKM.err
if [[ -a $logs/NKM_ERR.csv ]]
then
rm -f $logs/NKM_ERR.csv
elif [[ -a $logs/NKM1_CSV.csv ]]
then
rm -f $logs/NKM1_CSV.csv
fi
nawk -f . /opt/TradeOne/sandbox/garbage/srikanth/genKwdMisses.awk $logs/NKM.err | uniq > $logs/NKM.csv
genKwdMisses.awk (script code)
BEGIN {
FS="[()]"
OFS=","
}
{
split($1, a, " "
;
print a[1],$2
}
In keyword_misses script, when I am calling genKwdMisses.awk, I am specifying the 'absolute path' from where it should be invoked. But, when I execute the script, the output file NKM.csv, is empty.
NOW, if I remove the 'absolute path' and execute the script, from the directory location (instead of 'cron', the script works fine and generates an output file).
The 'docdetermination.new' file has data similar to..
2002.12.11 NO KEYWORD MATCH: (saree)
2002.12.11 NO KEYWORD MATCH: (saree)
2002.12.11 NO KEYWORD MATCH: (abc)
2002.12.11 NO KEYWORD MATCH: (abc)
2002.12.12 NO KEYWORD MATCH: (234qwe)
2002.12.12 NO KEYWORD MATCH: (234qwe)
Thanks for reading so much and trying to help me....
script-I (keyword_misses) runs from the 'cron'. The cron entry is:
20 19 * * 00 /opt/TradeOne/bin/keyword_misses >> /var/TradeOne/logs/keyword_misses.out 2>&1
keyword_misses (script code):
#!/usr/bin/ksh -p
#. $HOME/.profile
logs=/var/TradeOne/logs
grep 'NO KEYWORD MATCH' $logs/docdetermination.new >> $logs/NKM.err
if [[ -a $logs/NKM_ERR.csv ]]
then
rm -f $logs/NKM_ERR.csv
elif [[ -a $logs/NKM1_CSV.csv ]]
then
rm -f $logs/NKM1_CSV.csv
fi
nawk -f . /opt/TradeOne/sandbox/garbage/srikanth/genKwdMisses.awk $logs/NKM.err | uniq > $logs/NKM.csv
genKwdMisses.awk (script code)
BEGIN {
FS="[()]"
OFS=","
}
{
split($1, a, " "
print a[1],$2
}
In keyword_misses script, when I am calling genKwdMisses.awk, I am specifying the 'absolute path' from where it should be invoked. But, when I execute the script, the output file NKM.csv, is empty.
NOW, if I remove the 'absolute path' and execute the script, from the directory location (instead of 'cron', the script works fine and generates an output file).
The 'docdetermination.new' file has data similar to..
2002.12.11 NO KEYWORD MATCH: (saree)
2002.12.11 NO KEYWORD MATCH: (saree)
2002.12.11 NO KEYWORD MATCH: (abc)
2002.12.11 NO KEYWORD MATCH: (abc)
2002.12.12 NO KEYWORD MATCH: (234qwe)
2002.12.12 NO KEYWORD MATCH: (234qwe)
Thanks for reading so much and trying to help me....