View previous topic :: View next topic |
Author |
Message |
svan9420 n00b
Joined: 24 Apr 2002 Posts: 51
|
Posted: Wed Apr 28, 2004 7:16 pm Post subject: Another vixie cron problem |
|
|
I have checked around google, and read several tutorials on crontab.
I have created a script called getip.sh which just outputs to a file "working now dude"
Code: |
#!/bin/bash
echo "working now dude" >> working.out
|
This script has the following permissions:
Code: |
4 -r-xr-xr-x 1 randalls users 52 Apr 28 13:24 getip.sh
|
Date: Wed, 28 Apr 2004 13:31:00 +0000 (UTC)
From: Cron Daemon <root@norad.noneofyour.biz>
To: root@norad.private.biz
Subject: Cron <root@norad> root /home/randalls/bin/getip.sh >> /var/log/cron.log
/bin/bash: line 1: root: command not found
I have created a crontab as root using "crontab -e" for this script:
Code: |
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/root
*/1 * * * * root /home/randalls/bin/getip.sh >> /var/log/cron.log
|
This script should be set up to run every minute, which is a bit over kill but I want to see if I can get this script to work in cron. I check my output file to see if the scrip has ran and nothing happens. Now, every minute, I recieve and email from the cron daemon:
Code: |
Date: Wed, 28 Apr 2004 13:31:00 +0000 (UTC)
From: Cron Daemon <root@norad.private.biz>
To: root@norad.private.biz
Subject: Cron <root@norad> root /home/randalls/bin/getip.sh >> /var/log/cron.log
/bin/bash: line 1: root: command not found
|
1. Why am I recieving this error message.
2. How do i get my script to run properly. _________________ svan9420 |
|
Back to top |
|
|
Abraxas l33t
Joined: 25 May 2003 Posts: 814
|
Posted: Wed Apr 28, 2004 7:29 pm Post subject: |
|
|
Does it work without:
Code: | >> /var/log/cron.log |
_________________ Time makes more converts than reason. - Thomas Paine
Travel is fatal to prejudice, bigotry, and narrow-mindedness, and many of our people need it sorely on these accounts. - Mark Twain |
|
Back to top |
|
|
svan9420 n00b
Joined: 24 Apr 2002 Posts: 51
|
Posted: Wed Apr 28, 2004 7:34 pm Post subject: |
|
|
I edited my crontab file using crontab -e and change the line as specified. I still recieve an email stating:
Code: |
Date: Wed, 28 Apr 2004 13:52:00 +0000 (UTC)
From: Cron Daemon <root@norad.private.biz>
To: root@norad.private.biz
Subject: Cron <root@norad> root /home/randalls/bin/getip.sh
/bin/bash: line 1: root: command not found
|
Thanks _________________ svan9420 |
|
Back to top |
|
|
svan9420 n00b
Joined: 24 Apr 2002 Posts: 51
|
Posted: Wed Apr 28, 2004 7:50 pm Post subject: |
|
|
Here is my modified crontab
Code: |
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/root
*/1 * * * * root /home/randalls/bin/getip.sh
|
_________________ svan9420 |
|
Back to top |
|
|
svan9420 n00b
Joined: 24 Apr 2002 Posts: 51
|
Posted: Wed Apr 28, 2004 9:01 pm Post subject: |
|
|
I have an almost equivelant setup on another computer and it throws the same error. Is there some configuration directive I need to set in order to get cron to run properly?? _________________ svan9420 |
|
Back to top |
|
|
scwalla n00b
Joined: 22 Mar 2004 Posts: 20
|
Posted: Wed Apr 28, 2004 10:35 pm Post subject: |
|
|
svan9420 wrote: | Here is my modified crontab
Code: |
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/root
*/1 * * * * root /home/randalls/bin/getip.sh
|
|
* * * * * /home/randalls/bin/getip.sh |
|
Back to top |
|
|
Deathwing00 Bodhisattva
Joined: 13 Jun 2003 Posts: 4087 Location: Dresden, Germany
|
Posted: Wed Apr 28, 2004 11:03 pm Post subject: |
|
|
Moved from Installing Gentoo. |
|
Back to top |
|
|
b1nd3n14l Tux's lil' helper
Joined: 06 Jun 2003 Posts: 80
|
Posted: Wed Apr 28, 2004 11:16 pm Post subject: |
|
|
man 5 crontab _________________ Later...Gator...
First ever Gentoo Install: June 5th , 2003
Registered User #12078 at http://counter.li.org |
|
Back to top |
|
|
svan9420 n00b
Joined: 24 Apr 2002 Posts: 51
|
Posted: Thu Apr 29, 2004 1:02 am Post subject: |
|
|
Ok, I look at the man page for crontab. Where is my problem and how does this man page provide an answer??
Code: | CRONTAB(1) CRONTAB(1)
NAME
crontab - maintain crontab files for individual users (V3)
SYNOPSIS
crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }
DESCRIPTION
Crontab is the program used to install, deinstall or list the tables used to drive the cron(8) daemon in Vixie Cron. Each user can
have their own crontab, and though these are files in /var, they are not intended to be edited directly.
If the allow file exists, then you must be listed therein in order to be allowed to use this command. If the allow file does not exist
but the deny file does exist, then you must not be listed in the deny file in order to use this command. If neither of these files
exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use this command, or all
users will be able to use this command.
If the -u option is given, it specifies the name of the user whose crontab is to be tweaked. If this option is not given, crontab
examines "your" crontab, i.e., the crontab of the person executing the command. Note that su(8) can confuse crontab and that if you
are running inside of su(8) you should always use the -u option for safety's sake.
The first form of this command is used to install a new crontab from some named file or standard input if the pseudo-filename ``-'' is
given.
The -l option causes the current crontab to be displayed on standard output.
The -r option causes the current crontab to be removed.
The -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. After you
exit from the editor, the modified crontab will be installed automatically.
SEE ALSO
crontab(5), cron(8)
FILES
/etc/cron.allow
/etc/cron.deny
STANDARDS
The crontab command conforms to IEEE Std1003.2-1992 (``POSIX''). This new command syntax differs from previous versions of Vixie Cron,
as well as from the classic SVR3 syntax.
|
_________________ svan9420 |
|
Back to top |
|
|
b1nd3n14l Tux's lil' helper
Joined: 06 Jun 2003 Posts: 80
|
Posted: Thu Apr 29, 2004 2:24 am Post subject: |
|
|
you didnt do what i said,,,,
man 5 crontab
Youll get a different man page.. _________________ Later...Gator...
First ever Gentoo Install: June 5th , 2003
Registered User #12078 at http://counter.li.org |
|
Back to top |
|
|
ericseynaeve n00b
Joined: 14 Jan 2004 Posts: 15
|
Posted: Wed May 05, 2004 8:18 pm Post subject: |
|
|
I'm no cron expert myself, but isn't the syntax to use with `crontab -e` different from the one in /etc/crontab? Mainly: /etc/crontab needs to know as which user to run the command, `crontab -e` already knows that (the user that executed `crontab -e`). So try following line (remove the "root" part):
*/1 * * * * /home/randalls/bin/getip.sh
HTH |
|
Back to top |
|
|
|