Crontab Entry

Hi Everyone , have a nice day
given below is the line i have added in crontab

          • /Rauf/script2.sh

intended to run this script after every minute , when i run this script manually it runs fine and produces output , but after adding it to crontab ( like given above ) , it doesnt work

can anyone help

attributes of this script are

-rwxr-xr-x 1 root other 162 Feb 8 19:51 script2.sh*

Regards and Waiting

We might have some ideas if you show us the script.

But some options are:

  • You say the script produces output, where is this output send? To a file or to the screen? If it is the screen the script will not work because there is no tty attached to t.
  • A cron job runs by default with a very limited PATH environment variable. So if you don't define PATH inisde your script correctly, or use all commands with their full pah name, it could be that 1 or more commands cannot be located and therefore result in an error, which cause your script to terminate.

There are *hundreds* of threads here where this has been answered. Please use the search function.

#!/bin/sh
sleep 10
echo > /opt/scripts/air01axml.txt
echo >> /opt/scripts/air01axml.txt
rsh air01a tail -1 /var/opt/fds/statistics/FSC-AirXmlRpc_2.0_A_1-`date +%Y-%m-%d`-0000.stat >> /opt/scripts/air01axml.txt

This is the script .. :confused:

Make your crontab entry like this:

          • /Rauf/script2.sh > /tmp/result 2>&1

check /etc/result for errors.

Try this...

* * * * * cd /Rauf; script2.sh > /tmp/result 2>&1

check /tmp/result for error

and
check /var/cron/log file for cron