Cron job fails
Hi Experts,
We have an issue and need some expert advise. In one of the linux servers, we are running some cron jobs. This cron job loads flat files in to a table in a oracle database using a shell script. This was working fine. Recently we did an upgrade to kernel version and after that it loads the data half way and stops the cron job. (e.g. if there are 100 files, it loads about 13 files and stops). No error anywhere. Assuming that error is due to the kernerl issue we reversed the patch also. But still the problem is still there. When you execute the file upload shell script manually then it works fine. This is the OS details of the server OS name: Red Hat Enterprise Linux ES release 4 (Nahant Update 6) Kernel version: kernel-smp-2.6.9-89.0.23.EL Current Kernel version: Linux CCOLDWHZDBOP01 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 2010 i686 i686 i386 GNU/Linux Thanks a lot in advance. Best Regards Kushan |
If a cron job works fine manually, but not from cron, its usually because the path and environment variables are different when run by cron. Example, if a script uses tar, and tar is in your normal users path, then the script will work fine when run manually by that user. If tar is not in crons path, cron will not find tar and the script will fail when run automatically by cron. The update might have changed the way cron handles it's path and env variables. Something to investigate.
|
If the script you use only has one command, then this cron/path/env would probably not be the issue since it obviously found the command for at least 13 rows. If your script is long, and it inserts records at different places in the script, then the script is probably using some command not found in crons path.
|
Hi mreschke,
Thanks a lot for the reply. Its not that cron does not run at all. It uploads few files from the list and then stops. No errors on any logs. As i have mentioned above if i submit 100 files it uploads few like 13 - 15. When you run the same scrip in command prompt it uploads all 100 files. So it cant be an environment variable since it's able to execute half way isn't it ? Thanks and Regards Kushan |
Also text files use for the upload are almost similar. We even changed the files and tried but still it could upload only few when executing though the cron.
Best regards Kushan |
Are you logging inside the job, and are you redirecting the jobs output someplace useful?
Read through your output, read through your system logs from that same time-period. Are the jobs being run as root, as your user, as another user? If it dies halfway through we need a lot more information to diagnose it :) |
Is it the first 13 or so files, or is it a few from here and a few from there?
|
Thanks for all your replies.
As far as I can see, always the first few files upload successfully though the cron job. But when I execute the script manualy all the files get uploaded without any issues. Thanks a lot in advance. Kushan |
really just need more info, maybe we could see your script?
|
Easy steps for scheduling through cron
http://helpinlinux.blogspot.com/2010...sing-cron.html |
All times are GMT -5. The time now is 05:06 AM. |