Skip to contentSkip to conversation

Cronjobs

DISCUSSION Tom Troonbeeckx 7 participants 7 messages Jul 30, 2003

lore
Share & tools
lore
#0 lore raw

Dear Sir/Madam,

I have some proplem with mine cronjobs.

I edit mine /etc/crontab with the following command "crontab -e". The crontab looks like this

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

# run-parts
01 * * * * root run-parts /etc/cron.hourly
01 0 * * * root run-parts /etc/cron.daily
30 14 * * * root run-parts /etc/cron.twice.a.day
30 18 * * * root run-parts /etc/cron.twice.a.day
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min

I restarted the anacron-daemon. I tested the cronjobs individually and they work fine.
However, since I scheduled them I receive an email after each 5 and 15 minutes with the message
/bin/bash: root: command not found

I figured out that the crondaemon is trying to execute the command root. At some point it doesn't count the userprivilege of the cronjob.

The configuration looks in mine opinion fine. Any ideas what went wrong?

Thanks in advance....

Ideaxis nv
-facing the internet-

Flanders Multimedia Valley
Wetenschapspark 1
B-3590 DIEPENBEEK

Tel : +32 11 26 89 20
Fax : +32 11 23 22 17
Mobile: +32 479 13 14 81

E-Mail: [email protected]
URL: http://www.ideaxis.com/

Ideaxis nv legal disclaimer
The information contained in this e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by returning this e-mail. Please delete this e-mail and do not disclose its contents to any person. Ideaxis nv does not accept liability for any errors, omissions, delays of receipt or viruses in the contents of this message which arise as a result of e-mail transmission.

#1 lore raw

Hi Tom,

TT> I restarted the anacron-daemon. I tested the cronjobs individually and they TT> work fine.
TT> However, since I scheduled them I receive an email after each 5 and 15 TT> minutes with the message
TT> /bin/bash: root: command not found

It seems the daemon can not execute the bash shell, is the bash shell there, in the /bin directory? perhaps $PATH does not include the /bin directory?...

hope this help you...

TT> Ideaxis nv
TT> -facing the internet-

TT> Flanders Multimedia Valley
TT> Wetenschapspark 1
TT> B-3590 DIEPENBEEK

TT> Tel : +32 11 26 89 20
TT> Fax : +32 11 23 22 17
TT> Mobile: +32 479 13 14 81

TT> E-Mail: [email protected]
TT> URL: http://www.ideaxis.com/

TT> Ideaxis nv legal disclaimer
TT> The information contained in this e-mail is confidential and may be TT> privileged. It may be read, copied and used only by the intended recipient. TT> If you have received it in error, please contact the sender immediately by TT> returning this e-mail. Please delete this e-mail and do not disclose its TT> contents to any person. Ideaxis nv does not accept liability for any TT> errors, omissions, delays of receipt or viruses in the contents of this TT> message which arise as a result of e-mail transmission.

TT> -
TT> To unsubscribe from this list: send the line "unsubscribe linux-admin" in TT> the body of a message to [email protected]
TT> More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 7 lines
Best regards,
 César                            mailto:[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to Tom Troonbeeckx

Hi Tom,

Quoted 20 lines

I have some proplem with mine cronjobs.

I edit mine /etc/crontab with the following command "crontab -e". The crontab looks like this

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

# run-parts
01 * * * * root run-parts /etc/cron.hourly
01 0 * * * root run-parts /etc/cron.daily
30 14 * * * root run-parts /etc/cron.twice.a.day
30 18 * * * root run-parts /etc/cron.twice.a.day
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min
Quoted 7 lines

I restarted the anacron-daemon. I tested the cronjobs individually and they work fine.
However, since I scheduled them I receive an email after each 5 and 15 minutes with the message
/bin/bash: root: command not found

Isnt better to use :

1-56/5 * * * * root run-parts /etc/cron.5-min

or

*/5 * * * * .....
( I havent try that, but accorning to man page, it would work. )

vd, IT Admin of SuSE CR

#3 lore raw

The problem that you face is that crond does not have to deal with suid.

I think that you want to run the script "run-parts" suid as root. You did it wrong, editing the crontab for a common user (you), adding the magic word "root" and hopping that this will do the job.

You must edit the crontab for root, keep the sintax that you allready have or the sintax that vd suggested, omitting "root".

If your script does not need root privileges, it is better to run it as a normal user. This involves SECURITY.

Have a nice day from Romania!

                           ____    ____    o           ~ 
               //     //  / __ \  //   \  // //''''  //\\
              //_____//  / / / / //___ / // //      //  \\
             //     //  / /_/ / // \    // //      //____\\ 
            //     //   \____/ //   \  //  \\.... //      \\
 ------------------------------------------------------------------------
                          Comtec Net Romania
           ----------------------------------------------------
         WEB: www.eltop.ro IRC: irc.eltop.ro NEWS: news.eltop.ro
           ----------------------------------------------------
                    Horia Chirculescu [email protected]
                        Connex: +40 723 205 086
			Zapp:   +40 788 374 059
Quoted 43 lines · On Wed, 30 Jul 2003, [ISO-8859-1] Vladimír Dvoøák wrote:

Hi Tom,

Quoted 20 lines

I have some proplem with mine cronjobs.

I edit mine /etc/crontab with the following command "crontab -e". The crontab looks like this

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

# run-parts
01 * * * * root run-parts /etc/cron.hourly
01 0 * * * root run-parts /etc/cron.daily
30 14 * * * root run-parts /etc/cron.twice.a.day
30 18 * * * root run-parts /etc/cron.twice.a.day
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min
Quoted 7 lines

I restarted the anacron-daemon. I tested the cronjobs individually and they work fine.
However, since I scheduled them I receive an email after each 5 and 15 minutes with the message
/bin/bash: root: command not found

Isnt better to use :

1-56/5 * * * * root run-parts /etc/cron.5-min

or

*/5 * * * * .....
( I havent try that, but accorning to man page, it would work. )

vd, IT Admin of SuSE CR

Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Tom Troonbeeckx

* Tom Troonbeeckx <[email protected]> wrote on 30/Jul/2003 - 09:34:38 :

Quoted 28 lines

Dear Sir/Madam,

I have some proplem with mine cronjobs.

I edit mine /etc/crontab with the following command "crontab -e". The crontab looks like this

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

# run-parts
01 * * * * root run-parts /etc/cron.hourly
01 0 * * * root run-parts /etc/cron.daily
30 14 * * * root run-parts /etc/cron.twice.a.day
30 18 * * * root run-parts /etc/cron.twice.a.day
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min

I restarted the anacron-daemon. I tested the cronjobs individually and they work fine.
However, since I scheduled them I receive an email after each 5 and 15 minutes with the message
/bin/bash: root: command not found

Quoted 6 lines

I figured out that the crondaemon is trying to execute the command root. At some point it doesn't count the userprivilege of the cronjob.

The configuration looks in mine opinion fine. Any ideas what went wrong?

Thanks in advance....

By using "crontab -e" you're editing your personal cron file (located in /var/spool/cron in RedHat) and there you don't need the user who is running the commands ... so leaving out "root" from your lines should help.

old: 3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
new: 3,18,33,48 * * * * run-parts /etc/cron.quarter-hourly

By the way - if you want some jobs running every 15 minutes you can use the syntax

old: 3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
new: */15 * * * * run-parts /etc/cron.quarter-hourly

as well (I have to admit that I don't know adhoc how you can start it at the third minute ;-} ).

Hope this helps
Stefan

#5 lore raw
Quoted 35 lines · Stefan Wimmer

* Tom Troonbeeckx <[email protected]> wrote on 30/Jul/2003 - 09:34:38 :

Quoted 33 lines

Dear Sir/Madam,

I have some proplem with mine cronjobs.

I edit mine /etc/crontab with the following command "crontab -e". The crontab looks like this

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

# run-parts
01 * * * * root run-parts /etc/cron.hourly
01 0 * * * root run-parts /etc/cron.daily
30 14 * * * root run-parts /etc/cron.twice.a.day
30 18 * * * root run-parts /etc/cron.twice.a.day
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min

I restarted the anacron-daemon. I tested the cronjobs individually and they work fine.
However, since I scheduled them I receive an email after each 5 and 15 minutes with the message
/bin/bash: root: command not found

I figured out that the crondaemon is trying to execute the command root. At some point it doesn't count the userprivilege of the cronjob.

The configuration looks in mine opinion fine. Any ideas what went wrong?

Quoted 8 lines
Quoted 1 line

Thanks in advance....

By using "crontab -e" you're editing your personal cron file (located in /var/spool/cron in RedHat) and there you don't need the user who is running the commands ... so leaving out "root" from your lines should help.

old: 3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly
new: 3,18,33,48 * * * * run-parts /etc/cron.quarter-hourly

Yes and no.

The differentiation here is user crontab vs. system crontab.

User crontabs only permit 6 fields
mim hour day month day-of-week do-this-part

Only the system crontab has a 7th field. The extra field is at postion 6 and takes as an argument the username of the user under which do-this-part is to run.

The following are equivalent:
when logged in as user root,
crontab -e
3,18,33,48 * * * * run-parts /etc/cron.quarter-hourly

or edit the file /etc/crontab
3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly

Andy

#6 lore raw
In reply to Tom Troonbeeckx
Quoted 7 lines · Tom Troonbeeckx

Dear Sir/Madam,

I have some proplem with mine cronjobs.

I edit mine /etc/crontab with the following command "crontab -e". The crontab looks like this

Quoted 7 lines

3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly 1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min

However, since I scheduled them I receive an email after each 5 and 15 minutes with the message
/bin/bash: root: command not found

Curious, see what happens if you change the names of those files with "-" in them, maybe anacron is parsing those dashes. change them to "."
mv /etc/cron.5-min /etc/cron.5.min
etc
And change those lines in the crontab file.

--
Scott
long .signature files are annoying