Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-19-2005, 06:21 AM   #1
Registered: Sep 2005
Location: austria
Distribution: fedora,backtrack
Posts: 31

Rep: Reputation: 15
cron scripts

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

*/15 * * * * logres
and the script just does

echo `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
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.

Last edited by kirmet; 10-19-2005 at 06:23 AM.
Old 10-20-2005, 12:37 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Looking at:
echo /var/log/syslog | grep ....... | cut ..... > logres.ret

Are you sure you don't want:
cat /var/log/syslog | grep ....... | cut ..... >> logres.ret


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
What are you're best Cron scripts? deception Programming 7 11-11-2005 06:37 PM
expect scripts and cron banderson Linux - Software 8 05-27-2005 04:44 AM
can echo be used for popups in shell scripts run by cron? dr_zayus69 Linux - Software 4 04-12-2005 06:30 PM
How to retrieve email from cron scripts ? wallywood Linux - General 1 03-05-2004 03:34 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration