cooperrj
(usa Debian)
Enviado em 29/12/2009 - 08:21h
Salve galera.
Estou com problemas em rodar um script no cron.
Segue abaixo o script.
#!/bin/sh
DATAARQUIVO=`tail -n1 /var/log/qmail/qmail-send/current | tai64nlocal | cut -d" " -f1`
NOMEARQUIVO=$DATAARQUIVO.txt
rm -f /var/www/html/qmail-stats/Sent/$NOMEARQUIVO
mkdir /var/www/html/qmail-stats/LOG
#mkdir /var/www/html/qmail-stats/Sent/$DataPasta
cp /var/log/qmail/qmail-send/@* /var/log/qmail/qmail-send/LOG/
cp /var/log/qmail/qmail-send/current /var/log/qmail/qmail-send/LOG/
cat /var/log/qmail/qmail-send/LOG/* | grep failure >> /var/www/html/qmail-stats/LOG/Deferral.txt
cat /var/log/qmail/qmail-send/LOG/* | grep 'to local' >> /var/www/html/qmail-stats/LOG/Sent-Local.txt
cat /var/log/qmail/qmail-send/LOG/* | grep 'to remote' >> /var/www/html/qmail-stats/LOG/Sent-Remote.txt
cat /var/www/html/qmail-stats/LOG/Sent-Remote.txt >> /var/www/html/qmail-stats/LOG/Sent.txt
cat /var/www/html/qmail-stats/LOG/Sent-Local.txt >> /var/www/html/qmail-stats/LOG/Sent.txt
grep "<" /var/www/html/qmail-stats/LOG/Deferral.txt | cut -d'<' -f2 | cut -d'>' -f1 | sort | uniq >> /var/www/html/qmail-stats/Deferral/Deferral.txt
tail -n +0 /var/www/html/qmail-stats/LOG/Sent.txt | tai64nlocal | grep $DATAARQUIVO | cut -d " " -f10 | sort | uniq >> /var/www/html/qmail-stats/Sent/$NOMEARQUIVO
rm -f /var/log/qmail/qmail-send/LOG/*.*
rm -rf /var/www/html/qmail-stats/LOG/
Ele rodando manualmente funciona certinho, porem usando no cron ele simplesmente não enxerga o $DATAARQUIVO e o $NOMEARQUIVO. Alguma ideia do que possa ser?
Agradeço a ajuda.