LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-06-2004, 10:29 PM   #1
jwsisme
LQ Newbie
 
Registered: Nov 2002
Location: LA, CA
Distribution: Red Hat 7.3 and 8
Posts: 5

Rep: Reputation: 0
Can't Cron with Redhat


Hi,

I've been trying to get a cron job to send /var/log/ messages to my email address.

The cron job is this:

#!/bin/bash

# Email /var/log/messages to my email

ADMIN="myemail@email.com"

FN="mymessages"

mail -s "LOG for $FN" $ADMIN < /var/log/messages

____________

The error message is this:
/bin/bash: line 1: root: command not found.

The error does not seem to be from the crontab. This is the first cronjob I have attempted and I'm a newbie, so any help would be appreciated. My OS is Redhat Enterprise WS. Also- Is there another file that goes in the cron.hourly folder? I only have the cron file in the cron.hourly folder.

Help! Thanks!
 
Old 09-06-2004, 10:46 PM   #2
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 49
have you tried giving the full path for mail, for example

/bin/mail -s "LOG for $FN" $ADMIN < /var/log/messages
 
Old 09-08-2004, 01:00 AM   #3
jwsisme
LQ Newbie
 
Registered: Nov 2002
Location: LA, CA
Distribution: Red Hat 7.3 and 8
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the tip, it didn't work but I was able to fixed the issue.

I was getting an error in /var/log/messages , therefore I removed and recreated the /etc/crontab . I don't know if the crontab: /var/spool/cron/root caused problems, but I removed it as well.
 
  


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 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 09:09 AM
cron.allow and cron.deny in slackware? tl64 Slackware 5 10-13-2005 10:44 PM
No More Cron Mail, Cron Error? Xhost Linux - General 3 07-26-2004 05:28 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 10:57 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 03:30 PM


All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration