Visit Our UNIX and Linux User Community

cron command not found

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cron command not found
# 1  
Old 07-13-2002
cron command not found

I'm trying to execute a command in my crontab, but every hour I'm sent mail that says

/bin/bash: root: command not found

Does anyone know why I'm getting that message? It was in the crontab before I started screwing around with it and it was working fine. Now that I messed with it, ran a couple of tests, then restored the backup crontab, it doesn't work.
# 2  
Old 07-14-2002
Have you included the absolute path of your program to be run in your crontab file? Like:
/user/myprog instead of just myprog
# 3  
Old 07-14-2002
Absolute Path

If I understand which part of the line you're talking about, yes. I didn't put an absolute path to the command 'root', but I didn't think I needed to. I did use the absolute path for the program I am trying to run, though. Here is the line of code.

01 * * * * root run-parts /etc/cron.hourly

This is going to seem like a stupid question, but the only thing I've done with Unix is this crontab stuff, so I know next to nothing. What is the command used to run a program from the command line? I'd like to test out a couple programs in the cron.hourly directory, but I don't know how. Thank you for the reply!
# 4  
Old 07-15-2002
01 * * * * root run-parts /etc/cron.hourly
The format does not seem correct.

A crontab file consists of lines of six fields each. The
fields are separated by spaces or tabs. The first five are
integer patterns that specify the following:

01 * * * *
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).

(This part seems right...if you are trying to run once an hour at 1 minute past the hour)

The sixth field of a line in a crontab file is a string that
is executed by the shell at the specified times. A percent
character in this field (unless escaped by \) is translated
to a NEWLINE character.

This is where you are having a problem - you are putting 'root' as a command or script or executable to run - it isn't as far as the system can tell, hence the error.

What is the program or script or command you are trying to run?

What are you attempting to use /etc/cron.hourly for (the output?)?

If you want to see how it works for a command try this:

01 * * * * date > /tmp/uptodate.tmp

This will put the output of the date command into the tmp file uptodate.tmp and overwrite it every hour.

Read the man page on crontab - you should be able to figure it out from the examples given.
# 5  
Old 07-18-2002
hello there ,

first of all u need to make sure that your script is exectable CHMOD then do a crontab FILENAME to execute the crons
to see if what cron is running u need to do a crontab -l it will show th script thats running .

inside your script should be like this:

hr min * * * /filename

(ex: 16 00 * * * /filename) this will run srcript everyday at 1600hrs

* * * is your control for week day month if it is marked * * * that means it will run it everyday on the time u put in .

also make sure that ur script/cron ur running is on /usr/spool/cron/crontabs directory

Smilie art

Previous Thread | Next Thread
Test Your Knowledge in Computers #97
Difficulty: Easy
Unix is a multi-user operating system where the same resources can be shared by different users even if they do not have the proper permissions to do so.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

Ar command not found

Hi all, ar command not found on Solaris 10 version. We can execute under ./ar command /usr/ccs/bin directory. However, we want to execute ar command anywhere. We add to /usr/ccs/bin entry under /etc/profile file shown as below. umask 002 trap 2 3 ... (2 Replies)
Discussion started by: ziosnim
2 Replies

2. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

3. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

4. Shell Programming and Scripting

bash: <command nm> command not found

I created a script that I need to run from time to time, but get this error message. To get it working again I run this command from time to time: export PATH="$PATH:~/scripts" I put all my automated scripts in the /scripts directory and would like to run my scripts from any directory... (5 Replies)
Discussion started by: catalinawinemxr
5 Replies

5. Solaris

for: command not found

I have installed Solaris recently. I was doing "for file in *.c; ...." at the command prompt, it says for: command not found. I tried changing shells, but still wouldn't work. Any ideas? (7 Replies)
Discussion started by: software2007
7 Replies

6. Shell Programming and Scripting

cron job: command not found

Hi, I have a simple script. When I run it as cron job. I jot email saying: /bin/sh: line 1: test.tmp: command not found. the test.tmp looks like: #!/bin/sh date > done Even I took first line out, I got the same error. The current shell I have is /bin/tcsh Could anyone help me... (2 Replies)
Discussion started by: natxie
2 Replies

7. UNIX for Dummies Questions & Answers

bash: cron-config: command not found - PLEASE HELP ME!!

Hello All, I have installed Cygwin on Windows XP and working with some Shell scripting work, I have needed to schedule my script using the cornetab and whatever commands such as "cron", "cron-config" are not working in my cygwin shell, I re-installed the Cygwin but the same problem is with... (2 Replies)
Discussion started by: sriya
2 Replies

8. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

9. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies

10. Shell Programming and Scripting

How do I prevent cron from returning errors on a file not found?

find: /home/Upload/*: No such file or directory I am getting a find error when I run for FILE in `find /home/Upload/* -prune -type f -newer TIMEFILE` do I need to run this job every 10 minutes to upload any new files that were added. Is there an easy way to prevent this? Thanks (6 Replies)
Discussion started by: goodmis
6 Replies

Featured Tech Videos