hi there
i have an understanding problem i hope you can help me with.
i did a small cron script to get info out of a log file every 15 min and wrote it into antoher file with a timestamp.
so i opened the crontab -e
and did
Code:
PATH=/root/getlog/
*/15 * * * * logres
and the script just does
Code:
echo `date` >> logres.date
echo /var/log/syslog | grep ....... | cut ..... > logres.ret
so now here come 2 questions:
1) The little script works perfect when i start it from commando line.
Starting the script with cron on the other hand i just pasts an empty line to logres.date.
What is the reason for that? some kind of permission problems?
I started the crontab for root.
2) When i extracted all the info from the log file i would like to get rid of the content. How can this be done without actually deleting the file.
My (bad) solution is rm and touch which leads to a problem. after that it gets no more entries until reboot.
could you please when you have time explain in few words what goes wrong and why?
learning about linux and always looking for answers.