LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 04-28-2008, 05:55 PM   #1
kauaikat
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Rep: Reputation: 0
seg fault / mem fault - in cron, but works in shell?


Strange problem --

A detailed shell script in ksh which calls a specific program works just fine when run interactively. Now, if you run this same program in cron, it seg faults!

Yes, I have resolved all issues of environment with the sh vs ksh inside of cron. The irony is even with #!/bin/ksh in the script AND forcing it with a /bin/ksh on the crontab entry the program still does a memory fault. If I let it try to execute under default of /bin/sh, it does a seg fault. But the program works flawlessly if you execute the script in an interactive session.

1. there are no inputs other than reading from files and writing to database.

2. the only difference is a cron entry vs. ./script_name

What could be causing this? Any thoughts or ideas?

AS 4 - updated with all patches. vixie_cron 4.1.x, so I am at my wits end on this.

thanks
 
Old 04-29-2008, 04:24 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You say you've resolved all issues of environment sh vs ksh.

That doesn't sound like you've worked on environment variables (e.g. PATH).

Cron scripts don't inherit these variables the way your command line does because you're not sourcing /etc/profile, /etc/bashrc, $HOME/.profile and/or $HOME/.bashrc in cron.

You need to insure you set all necessary environment variables in your script OR source them from an external file.

A good way to see what you need is to type "env" when logged in at command line. Look at the environment information it gives and put whatever you think necessary in the script.

The number one issue with scripts run from cron vs command line is PATH. The PATH you have at command line (echo $PATH) is apt to have many things in it whereas the PATH cron uses is rudimentary.
 
  


Reply


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
seg fault vm_devadas Linux - Enterprise 1 12-05-2006 02:28 PM
what could cause this fwrite() to seg fault? hedpe Programming 11 02-12-2006 10:02 PM
C seg fault drigz Programming 5 10-01-2004 03:35 PM
ut2004 seg fault dopefish Linux - Games 3 04-11-2004 02:44 AM
xmms - seg fault :( :( xconspirisist Linux - Software 2 02-07-2004 05:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 03:38 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration