LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-05-2012, 09:30 AM   #1
DirtyHowi
Member
 
Registered: Jan 2012
Posts: 34

Rep: Reputation: Disabled
odd (or not) problem with root


RHEL 6.1, when we send an email from our cobol system it goes out from root, which we have aliased in our postfix file and another custom file as (company) orderdesk@company.com. this works fine everything flows like it should.

we also have a cron job that runs every few minutes (15 i think) and goes and pulls text files out of a directory and attaches them to email and sends them as root@servername.company.local.

i can manually run the program that the cron job runs, even logged in as root and it runs fine, but fails to run when done via cron.

anyone seen this before? i'm having a tough time understanding why when manually executed it works perfectly, but when automatically executed it fails. same code both times.

tia
 
Old 04-05-2012, 09:41 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

I've seen symptoms you describe. There isn't a global solution, it could be the crontab entry, missing variables in your crontab, the script could use environment settings that aren't present when run from cron, etc.

Did you check the log files? Anything stand out?

If that doesn't help: Can you post the script and the full crontab entry?

Hope this helps.
 
Old 04-05-2012, 09:43 AM   #3
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Hi DirtyHowi,

That depends on how you have put that in cron. If it works from the command line then it appearss to me as @ symbol is creating problem.

Did you try putting that command in a file and running that file as a script via cron?
 
Old 04-05-2012, 09:47 AM   #4
DirtyHowi
Member
 
Registered: Jan 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
its a cobol program that gets called, not just a script, so if i runcbl PROGNAME it runs fine. run from cron it doesnt. it makes it to our email appliance and then stops there, so it is getting out, just not out of the building. when run manually it picks up the root email from postfix, run from cron it doesn't.
 
Old 04-05-2012, 12:01 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
It's probably something to do with the difference in the shell/process environment between running under cron and running from the command prompt. Assuming the shell logon scripts don't prompt the user for input you could test that theory by running the cron job as root with an su - (the - is important) to the normal user.

If the email goes out then, at least you know the problem area to look in. A likely area is environment variables but it could be others -- current directory, umask, limits ...
 
  


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
Slackware 13 Network Problem, Odd Problem With 70-persistent net.rules pghsteel Slackware 4 08-16-2010 03:58 AM
[SOLVED] Odd root login problem on vtty Keith Hedger Slackware 4 07-30-2010 09:42 AM
Odd root pwd behavior solstice123 Ubuntu 10 10-11-2005 08:54 PM
Odd problem zitstif Linux - Networking 2 08-17-2005 01:42 PM
An odd problem moger Linux - Hardware 5 09-25-2002 09:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:37 PM.

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