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


Closed Thread
  Search this Thread
Old 07-28-2010, 10:31 AM   #1
alabama78
LQ Newbie
 
Registered: Jul 2010
Posts: 6

Rep: Reputation: 0
crontab wont work - runs manually fine


Sorry - wrote this message a couple of weeks ago then went on holiday.

My jar file runs fine manually - but fails to pick up a properties file when ran through crontab, any ideas???

throws it out into the exception part of this code


try {
props.load(new FileInputStream("test10.properties"));
// assign value to message variable only if it is not null
if(props.getProperty("Propfile_day") !=null)
{
Propfile_day = props.getProperty("Propfile_day");
Propfile_monthyear = props.getProperty("Propfile_monthyear");
Propfile_country = props.getProperty("Propfile_country");
Propfile_airport = props.getProperty("Propfile_airport");
}
}

//catch exception in case properties file does not exist
catch(IOException e)
{
System.out.println("error in prop file");
}

the crontab is pretty basic...


41 11 * * * /home/seleniumTestResults/runTests.sh 2>&1 > /home/seleniumTestResults/executeTests.log

the runTest.sh looks like this

#!/bin/bash
export HOME="/root"
/usr/java/jdk1.5.0_12/bin/java -classpath /home/seleniumTestResults/shopOneSelenium.jar selenium.automation.Test

Last edited by alabama78; 07-28-2010 at 10:37 AM.
 
Old 07-28-2010, 10:50 AM   #2
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Is your shell script have execute permission ?

set execute permission

chmod 755 filename

OR

use bash command in crontab

Code:
41 11 * * * /bin/bash /home/seleniumTestResults/runTests.sh 2>&1 > /home/seleniumTestResults/executeTests.log
HTH
 
Old 07-28-2010, 11:08 AM   #3
alabama78
LQ Newbie
 
Registered: Jul 2010
Posts: 6

Original Poster
Rep: Reputation: 0
tried both and it does the same unfortunatetly, the shell script does execute, but it fails in this part of the code

Last edited by alabama78; 07-28-2010 at 11:10 AM.
 
Old 07-28-2010, 11:20 AM   #4
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
What does the error say? -_-;
 
Old 07-28-2010, 11:23 AM   #5
alabama78
LQ Newbie
 
Registered: Jul 2010
Posts: 6

Original Poster
Rep: Reputation: 0
.error in prop file
E
Time: 16.37
There was 1 error:
1) testTest(selenium.automation.Test)java.lang.NullPointerException
at selenium.automation.Test.testTest(Test.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at selenium.automation.Test.main(Test.java:35)

FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
v
 
Old 07-28-2010, 01:17 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

http://www.linuxquestions.org/questi...y-fine-818922/
 
  


Closed Thread


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
crontab wont work - runs manually fine alabama78 Linux - Newbie 5 08-02-2010 07:12 AM
[SOLVED] script not running via crontab, run's fine manually astroboiii Linux - Software 10 02-08-2010 10:36 PM
UBUNTU Intrepid Gampad Dpad wont work, works fine in jcalibrator zonemikel Linux - Hardware 1 03-22-2009 06:42 PM
When i try to play gmod or half life, it runs great, but the controls wont work..help t-bone09 Linux - Games 11 12-23-2008 02:05 AM
script runs fine from a command line, but doesn't work from cron? kleptophobiac Linux - Software 5 05-03-2004 04:14 PM

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

All times are GMT -5. The time now is 12:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration