LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 04-07-2010, 09:47 AM   #1
kushanx
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
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
 
Old 04-07-2010, 09:50 AM   #2
mreschke
LQ Newbie
 
Registered: Mar 2010
Distribution: Arch, Ubuntu, LFS
Posts: 18

Rep: Reputation: 4
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.

Last edited by mreschke; 04-07-2010 at 09:52 AM.
 
Old 04-07-2010, 09:54 AM   #3
mreschke
LQ Newbie
 
Registered: Mar 2010
Distribution: Arch, Ubuntu, LFS
Posts: 18

Rep: Reputation: 4
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.
 
Old 04-07-2010, 09:55 AM   #4
kushanx
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
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

Last edited by kushanx; 04-07-2010 at 10:06 AM.
 
Old 04-07-2010, 10:00 AM   #5
kushanx
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
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
 
Old 04-07-2010, 11:13 AM   #6
kschmitt
Member
 
Registered: Jul 2009
Location: Chicago Suburbs
Distribution: Crux, CentOS, RHEL, Ubuntu
Posts: 96

Rep: Reputation: 23
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
 
Old 04-07-2010, 11:24 AM   #7
Fingers of Fudge
LQ Newbie
 
Registered: Aug 2007
Distribution: Slackware 13.0
Posts: 14

Rep: Reputation: 1
Is it the first 13 or so files, or is it a few from here and a few from there?
 
Old 04-07-2010, 01:09 PM   #8
kushanx
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
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
 
Old 04-08-2010, 10:46 AM   #9
mreschke
LQ Newbie
 
Registered: Mar 2010
Distribution: Arch, Ubuntu, LFS
Posts: 18

Rep: Reputation: 4
really just need more info, maybe we could see your script?
 
Old 04-09-2010, 01:05 AM   #10
Randeep
LQ Newbie
 
Registered: Apr 2010
Location: Bangalore
Distribution: Redhat, Centos
Posts: 25

Rep: Reputation: 0
Easy steps for scheduling through cron
http://helpinlinux.blogspot.com/2010...sing-cron.html
 
  


Reply

Tags
cron


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron job issue - every hour works, but specific hour fails lunarleviathan Linux - Newbie 6 11-20-2009 12:19 AM
linux cron job duplicate job question cpthk Linux - Newbie 4 09-11-2009 08:52 PM
cron job fails, but command in crontab succeeds when directly entered rmunsch Linux - Server 2 02-16-2009 05:27 PM
shell prompt works, cron job fails btuley Linux - General 1 11-13-2008 11:40 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM


All times are GMT -5. The time now is 06:32 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration