1753971 Members
8255 Online
108811 Solutions
New Discussion юеВ

Cron Job Issue

 
SOLVED
Go to solution
shameemsoft
Frequent Advisor

Cron Job Issue

Dear,

We have created one script to collect recent files(when this script executed, it will check less than one hour time stamp files) and zip that files and transfer to other server.

When i run the script manually, it is working properly.

I tried with cron job. But it is not taking any files & zip file is created with 0 bytes and transferred to other server.

I am confusing why it is not executing with correct output only in cron job.

Kindly clarify on this.

Thanks in Advance
Shameem
24 REPLIES 24
Johnson Punniyalingam
Honored Contributor
Solution

Re: Cron Job Issue

>>I am confusing why it is not executing with correct output only in cron job. <<

check on the "cron logs" to send some light on your problem

/var/adm/cron/log ? and also it could better if you can post "entry of your crontab" and location of the script which you are calling
Problems are common to all, but attitude makes the difference
Horia Chirculescu
Honored Contributor

Re: Cron Job Issue

Hello,

Try to set up in your srcipt the shell you are using and set the PATH variable (copy the value from profile)

Horia.
Best regards from Romania,
Horia.
shameemsoft
Frequent Advisor

Re: Cron Job Issue

Thanks a lot your quick response.

Find cron entry. i changed the time now for testing.

50 14 * * * /home/eppadm/scripts/epp-sync-j2ee-daily.sh

Log file information below.

> root 6826 c Tue Feb 23 14:50:00 WAT 2010
> CMD: /home/eppadm/scripts/epp-sync-j2ee-daily.sh
> root 6827 c Tue Feb 23 14:50:00 WAT 2010
< root 6825 c Tue Feb 23 14:50:00 WAT 2010
< root 6826 c Tue Feb 23 14:50:01 WAT 2010
< root 6827 c Tue Feb 23 14:51:18 WAT 2010

#!/bin/sh shell information updated in the script.

Which PATH variable need to set?

Kindly check and provide your feedback.

Thanks in Advance
Shameem
johnsonpk
Honored Contributor

Re: Cron Job Issue

Hi Shameem,

Looks like environment and PATH for the commands in your script is not defined.

Define it PATH variable in your script or replace each command with its absolute path.

Regards!
Johnson
Horia Chirculescu
Honored Contributor

Re: Cron Job Issue

Edit your script

/home/eppadm/scripts/epp-sync-j2ee-daily.sh

And define the PATH in there (get it from profile)

Horia.
Best regards from Romania,
Horia.
Sachin Kumbla
Frequent Advisor

Re: Cron Job Issue

As johnson said check the cronlogs whether is script is executing or not.

Also check for the absolute path of the script in your crontab.

Check for the permission of the script/file & the directory structure.should have execute permission for the script file for the owner of the sript/file.

Rgds.,
Sachin Kumbla.
johnsonpk
Honored Contributor

Re: Cron Job Issue

can you post the script /home/eppadm/scripts/epp-sync-j2ee-daily.sh
Horia Chirculescu
Honored Contributor

Re: Cron Job Issue

#!/bin/sh
#

PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:.....

Copy the value from your user's profile.

Horia
Best regards from Romania,
Horia.
shameemsoft
Frequent Advisor

Re: Cron Job Issue

Thanks for your response.

I updated PATH. i have taken path details from /etc/profile.

Still it is not working... Again i am telling this script is working properly when i execute manually :).

I have attached script in the attachment.