LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-20-2005, 03:39 PM   #1
vgolden
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
Unhappy C++ prorgam runs OK from command line, but failed from crontab


I have fairly large C++ program which we ported from NT. I compiled it on RedHat Linux as:

c++ -Wno-deprecated -static -o <prog_name> -x c++ *.cpp

than it is called from the shell script.

When I execute shell script from the command line C++ program runs just fine. Horever, when the same shell script run from the crontab, C++ failed with:

2831 Segmentation fault

It even not attempting to run!

Any ideas? Any help will be greatly appreciated
 
Old 01-20-2005, 06:25 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Perhaps something in the enviroment is not set whne you use cron, but it is set when you run from shell. Home directory, it expects to executed from a certain place? Do you have absolute or relative paths coded in?
 
Old 01-21-2005, 11:00 AM   #3
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
Re: C++ prorgam runs OK from command line, but failed from crontab

Quote:
Originally posted by vgolden
I have fairly large C++ program which we ported from NT. I compiled it on RedHat Linux as:

c++ -Wno-deprecated -static -o <prog_name> -x c++ *.cpp

than it is called from the shell script.

When I execute shell script from the command line C++ program runs just fine. Horever, when the same shell script run from the crontab, C++ failed with:

2831 Segmentation fault

It even not attempting to run!

Any ideas? Any help will be greatly appreciated
cron generally runs commands from the "sh" shell but when you run it from the command line it runs from whatever shell you are using. Are you using a "bang line" like "#!/bin/csh" or "#!/bin/bash"as the first line of the shell script you are trying to run? This should make the results the same whether you run under cron or the command line. (Of course, that may mean it fails under both too!)
 
  


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
Bind9: NDC command failed : rndc: connect failed: connection refused Boudewijn Linux - Networking 19 01-02-2014 07:19 AM
my database export shell script run from command line but not form crontab saifee Linux - General 11 01-29-2012 09:24 AM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
script runs fine from a command line, but doesn't work from cron? kleptophobiac Linux - Software 5 05-03-2004 04:14 PM
Command line runs back on itself SharpyWarpy Linux - General 2 11-25-2003 06:56 PM


All times are GMT -5. The time now is 12:06 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