LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-23-2012, 12:50 PM   #1
sueco
LQ Newbie
 
Registered: May 2011
Posts: 4

Rep: Reputation: Disabled
crontab .jar syntax


Hi people!

I have done some java program that reads stuff from different webpages and inserts some of the retrieved data into a database. I did the java stuff in eclipse and exported it as an executable jar file.

Which works fine if i go (in terminal) to the directory where the jar file is and write

Code:
java -jar database.jar
I can see that the database is updated with new data.

My problem appears when I try to run it from the crontab. I can't figure out what to write to make it work.

This is what I have wrote in the crontab....

Code:
sudo crontab -e
edit the file with...

Code:
*/5 * * * * /home/xxx/CODE/Database/java -jar database.jar
I have tried different alternatives but without making the java code to run...
So, anyone that can help me out with the right crontab statement???

thanks

sueco
 
Old 08-23-2012, 01:10 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
Maybe you need the full path to the jar file?

For example:
*/5 * * * * /home/xxx/CODE/Database/java -jar /home/xxx/CODE/Database/database.jar
 
Old 08-24-2012, 12:03 PM   #3
sueco
LQ Newbie
 
Registered: May 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for the help, I figured it out now.
I don't needed the path to Java.

*/5 * * * * java -jar /home/xxx/CODE/Database/database.jar
 
1 members found this post helpful.
Old 08-24-2012, 12:27 PM   #4
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
Glad you got it fixed. Please go to thread tools and mark this as Solved. It helps others more easily find solutions when they have similar problems in future.
 
  


Reply



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 syntax question kaplan71 Linux - General 2 01-25-2010 10:35 AM
Correct syntax for days in crontab kaplan71 Linux - General 1 03-12-2009 12:46 PM
Linux Crontab Syntax shritesh Linux - Software 1 01-03-2007 02:43 AM
How to type in syntax to create a crontab with RH9 SoNewItHurts Linux - Newbie 5 02-20-2004 12:09 AM
crontab syntax niehls Linux - General 1 03-08-2003 11:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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