LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't Cron with Redhat (https://www.linuxquestions.org/questions/linux-newbie-8/cant-cron-with-redhat-227506/)

jwsisme 09-06-2004 09:29 PM

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!

ppuru 09-06-2004 09:46 PM

have you tried giving the full path for mail, for example

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

jwsisme 09-08-2004 12:00 AM

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.


All times are GMT -5. The time now is 11:16 AM.