1837897 Members
3399 Online
110123 Solutions
New Discussion

cronjob

 
khilari
Regular Advisor

cronjob

Hi people, how r u. Okay so here is teh situation. i made a simple script find /test -name cron -print in the /test/cron
then i put it in the cronjob as
1 * * * * /test/cron expecting it to work and show me the command find /test/cron -name cron -print every minute. Can u kindly tell me what i should do to make it work
4 REPLIES 4
Arunvijai_4
Honored Contributor

Re: cronjob

Hi Khilari,

You need to redirect stdout and sterr to files,something like

1 * * * * /test/cron 2>/tmp/log2 1>/tmp/log1

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
James R. Ferguson
Acclaimed Contributor

Re: cronjob

Hi:

In crontasks, any STDOUT or STDERR that is not redirected to a file will be mailed to the user that initiated the task. Check you mail.

Regards!

...JRF...
Arturo Galbiati
Esteemed Contributor

Re: cronjob

Hi,
login as the user where the cron script runs and type elm.
you will see all your outputs.
To avoid this you shoudl redirect teh cron command to a file:
1>/tmp/.log 2>&1

HTH,
Art
Muthukumar_5
Honored Contributor

Re: cronjob

Try like,

1 * * * * find /test -name cron -print 1>/test/out.log 2>/test/err.log

and save cron job.

See /test/out.log file for output. If you want to update in the same file then,

1 * * * * find /test -name cron -print 1>>/test/out.log 2>/test/err.log

--
Muthu
Easy to suggest when don't know about the problem!