R> When tasks are running from my crontab It send to my mail next
R> message "/bin/bash: root: command not found", but these tasks
R> started successfully.

Do I understand correctly that you get the error from cron, but not
when you try the same commands on the command line?

If so, this is most typical because cron sets up a very limited
environment for the program, e.g., a very basic path, while you
usually has a lot of extra settings in the environment.  

I use the following little script to test any command I put into
crontab:


  #!/bin/ksh 
  # Set up the right environment to test a shell file for cron
  
  home=$HOME
  logname=`whoami`
  path=/usr/bin:/usr/sbin:.
  shell=/usr/bin/sh 
  
  env -i HOME=$home LOGNAME=$logname PATH=$path SHELL=$shell  /usr/bin/sh -x $*

One note: I originally wrote if for Sun Solaris.  I could not find
anywhere in the linux man pages where it is stated what setting PATH
will have inside a cron job.   So the setting above might be wrong.

Best

Peter
-- 
http://cs-people.bu.edu/turtle/contact.html
``Deserves death! I daresay he does. Many that live deserve death. 
And some that die deserve life. Can you give it to them?  
Then do not be too eager to deal out death in judgement.'' -- Tolkien

Reply via email to