LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-15-2010, 01:49 PM   #1
EnderX
Member
 
Registered: Nov 2006
Posts: 66

Rep: Reputation: 15
Difference between manual run and crontab run?


My predecessor wrote a perl file that is run manually twice a month to send a set of emailed reports to one of our clients. My boss has requested that I look into automating this; it seemed simple enough, and I thought I had it set up, but I'm running into a rather strange problem.

Both the emailing program (in perl) and the report files themselves are kept on a Novell server reached from our Linux box via /mnt/srv/path/to/file/. From the linux box, I can see and manipulate them fine. The files are displayed as having 755 permissions across the board. The Linux box itself is running SuSE 9.3.

A manual run of the emailing program works fine; the files are sent out as expected. However, when I tried to set up a crontab entry for this, I'm running into trouble. I manually edited /etc/crontab to include a line setting the program to run at '0 21 * * 1,2,3,4,5'. The program itself runs fine, but errors out every time it tries to attach a file; the error message is one that various perl sites indicate means 'could not read the path to this file'.

What's the difference between a cron run and a manual run? What are some possible reasons the former fails and the latter works?
 
Old 01-15-2010, 02:19 PM   #2
fang0654
Member
 
Registered: Oct 2003
Location: New York, NY
Distribution: Ubuntu
Posts: 110

Rep: Reputation: 28
Possible differences:

What user is the crontab run as? Is it run as root?
Are all of the paths fully qualified? I believe when a cron job runs, it doesn't run with the environment variables you have when you are logged in the shell.
 
1 members found this post helpful.
Old 01-15-2010, 03:18 PM   #3
adam999
Member
 
Registered: Sep 2006
Posts: 105

Rep: Reputation: 18
can you cat the /etc/crontab file so we can see exactly what you've done?
 
Old 01-15-2010, 03:46 PM   #4
EnderX
Member
 
Registered: Nov 2006
Posts: 66

Original Poster
Rep: Reputation: 15
Thank you for pointing that out.
There was a point in the code where it was looking for a relative path to a file; I've personally run that file manually from multiple directories before and had it work, so that particular path may have been in the environment variables for my login. Coding the path into place ahead of it allowed a crontab run to go ahead successfully; thank you for your assistance.
 
  


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
[SOLVED] crontab didn't run qwertyjjj Linux - Newbie 28 08-14-2009 07:04 AM
How to run this script in Crontab baig Linux - Newbie 2 11-30-2008 02:34 PM
Cannot get crontab to run uncle-c Linux - Newbie 4 02-12-2008 06:05 AM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM
Can't run F-Prot with Crontab maxflex Slackware 7 07-31-2004 10:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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