LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-06-2009, 07:21 AM   #1
tatacalu
LQ Newbie
 
Registered: Apr 2006
Posts: 25

Rep: Reputation: Disabled
Arrow Cron mail - /bin/bash: command not found


Hello!

I have a server set up with Fedora Core 6.

In my crontab I have:

Quote:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

[... other declarations...]

#
# piwik cron
#
MAILTO="address@domain.tld"
@hourly apache /var/www/html/piwik/misc/cron/archive.sh > /dev/null
Now, I have 2 questions:
1. Can I declare MAILTO=... multiple times ? [Is there any issue if I declared mailto multiple times ?]
2. I keep getting these strange e-mails:

Root mailbox:
Quote:
Subject: Cron <root@domain> root run-parts /etc/cron.hourly
Body:
/bin/bash: root: command not found
address@domain.tld mailbox:
Quote:
Subject: Cron <root@domain> apache /var/www/html/piwik/misc/cron/archive.sh > /dev/null
Body:
/bin/bash: apache: command not found
The directory /etc/cron.hourly is empty;

Does anybody have any suggestion?

Thank you
 
Old 03-06-2009, 09:07 AM   #2
chitambira
Member
 
Registered: Oct 2008
Location: Online
Distribution: RHEL, Centos
Posts: 373
Blog Entries: 1

Rep: Reputation: 51
how do you edit your crontab? seems like formating is bad. Try to use crontab -e rather than directly editing /etc/crontab. Multiple Mailto's are ok as long as aech is immediately followed by the cron entry which it is responsible for.
 
Old 03-06-2009, 09:19 AM   #3
tatacalu
LQ Newbie
 
Registered: Apr 2006
Posts: 25

Original Poster
Rep: Reputation: Disabled
What is wrong with the formatting ? I mean.. when i run crontab crontab I don't get any error messages [I got in the past a few times] ... so, as long as crontab doesn't complain... are there chances that the formatting is bad ?

Oh, and regarding multiple mailto, consider the following fictive example:
Quote:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

[... other declarations...]

#
# piwik cron
#
MAILTO="address@domain.tld"
@hourly apache /var/www/html/piwik/misc/cron/archive.sh > /dev/null

01 * * * * [command123]
if a mail would be sent from the last command (command123), where would the mail end up? In the root mailbox or in the address@domain.tld mailbox ?

I mean.. if you declare mailto multiple times, the 2nd time, 3rd time, 4th time etc those declarations will stand up only for the next cron command ? or they will remain active until the next mailto overwrites them ?
 
Old 03-06-2009, 09:39 AM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by tatacalu
Now, I have 2 questions:
1. Can I declare MAILTO=... multiple times ?
No. The latest declaration will supersede the previous ones.

Quote:
Originally Posted by tatacalu
2. I keep getting these strange e-mails:

Root mailbox:
Code:
Subject: Cron <root@domain> root run-parts /etc/cron.hourly
Body:
/bin/bash: root: command not found
If you carefully read the email, you'll see that it is trying to run a command:
Code:
root run-parts /etc/cron.hourly
And, as noted, root is not a command that is found.

Looks like you've put /etc/crontab format in to root's personal crontab (edited via crontab -e). Remove the field containing "root". See the crontab(5) manpages for details.
 
  


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
bash: mail : command not found Tanc Debian 1 12-27-2008 05:18 PM
/bin/sh: CC : command not found Pikidalto Linux - Software 7 05-11-2008 02:03 AM
/bin/bash: root: command not found pridefc Red Hat 5 12-12-2006 07:09 PM
(bash) echo "#!/bin/bash" event not found - trying to generate profiles automatically jimieee Programming 9 05-03-2006 10:24 AM
Error when starting up snort: bash:!/bin/sh/usr/local/bin/snort :Eent not found cynthia_thomas Linux - Software 1 11-11-2005 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:37 PM.

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
Open Source Consulting | Domain Registration