LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-26-2006, 11:11 AM   #1
c_curtis
LQ Newbie
 
Registered: Jun 2006
Distribution: Debian
Posts: 8

Rep: Reputation: 0
cron job runs but will not write to logfile


I have a cron job that runs everyday at set time--the job executes and runs but will not write to a logfile--0k. The kicker is that when I run the job manually it works and logs just fine. I am grateful for any help at this point.
 
Old 06-26-2006, 12:00 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,120
Blog Entries: 54

Rep: Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788
Hello there and welcome to LQ. Hope you like it here.

the job executes and runs but will not write to a logfile
If it prints to stdout then the report could be in the email (of the crontab user).
If it's not in the email then try appending "2>&1>>/some/logfile" to the crontab line and see if that fixes it.
Else if it doesn't print to stdout, does it have a logfile writing flag?
If it does, does the user you run it as (crontab user) has the permission to write to the logfile?
Else please post what app this is about.
 
Old 06-26-2006, 12:45 PM   #3
c_curtis
LQ Newbie
 
Registered: Jun 2006
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for the suggestion--unfortunately it did not work. The app in question is Avast antivirus. I know there are ALOT of people that will tell me that AV is not needed or "why bother with AV on Linux" but it is a necessity in this situation.
 
Old 06-26-2006, 01:13 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,120
Blog Entries: 54

Rep: Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788
Thanks for the suggestion
Which one? There's a few of them (and questions as well). Please read carefully.
 
Old 06-27-2006, 03:08 AM   #5
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
AntiVirus will most likely be run as root user.
Have you set up mail for root properly? In some cases, for instance, a mail alias is used to send root's e-mails off to a "real" user.

Also, if it works manually, but not from cron, one of my first suspects is usually the environment variables.
Cron jobs use their own environment settings, so please check if the variables you use are properly set.
 
Old 06-27-2006, 03:37 AM   #6
SlackDaemon
Member
 
Registered: Mar 2006
Distribution: RedHat, Slackware, Experimenting with FreeBSD
Posts: 222

Rep: Reputation: 30
Check if your /etc/syslog.conf file has the following line added:

cron.* /var/log/cron


cheers!

*EDIT*

whoops! didn't look through your second sentence so probably that entry is ok.

Last edited by SlackDaemon; 06-27-2006 at 03:43 AM.
 
Old 06-28-2006, 09:14 AM   #7
c_curtis
LQ Newbie
 
Registered: Jun 2006
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for all the help -- I believe everything is set up correctly. hmmm. Here is what I have going on -----

*/7 * * * * /home/user/name0.sh >/var/log/avast4/opt.log 2>&1

#!/bin/bash
/bin/avastcmd -p3 /opt > /var/log/avast4/opt.log
 
Old 06-28-2006, 09:53 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,120
Blog Entries: 54

Rep: Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788
avastcmd -r logfile?
 
Old 06-28-2006, 10:10 AM   #9
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Is the directory /var/log/avast4 writable for your user? Or is the cron job run as root?
 
Old 06-30-2006, 08:12 AM   #10
c_curtis
LQ Newbie
 
Registered: Jun 2006
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
I have finally figured out the problem. There is a bug when trying to run avastcmd with cron. The people @ avast have sent me the "fix" and I am going to try it today. I will report back with any pertinent information.

Thanks for all of the help.

Chad
 
Old 06-30-2006, 09:25 AM   #11
c_curtis
LQ Newbie
 
Registered: Jun 2006
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
The fix consisted of a new exe--once untarred and set up everything works. Again, thanks for all input.

Chad
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell scripting: Print output to logfile, error to logfile & screen stefanlasiewski Programming 18 05-22-2008 12:47 PM
How to write a script to run bitdefender antivirus as a cron job? ginda Linux - Software 1 03-10-2005 08:08 PM
cron job only runs halfway aunquarra Linux - General 15 01-31-2005 04:53 PM
Why Does One Cron Job Runs Twice? cpope67 Programming 4 11-16-2004 06:09 AM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM


All times are GMT -5. The time now is 03:17 PM.

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