LinuxQuestions.org
Register a domain and help support LQ
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 07-28-2004, 05:34 PM   #1
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Rep: Reputation: 0
cron job


i know this might have been asked but can someone help me with this


I want my .jar to be run every monday and friday I am trying to add it to a cron job or something like that anyone have any ideas?


I was guessing something like 0 3 java -jar myFile.jar

I am not sure where to add it and the exact syntax and how stuff works



HELP PLS!

working2hard :Pengy
 
Old 07-28-2004, 06:05 PM   #2
SheldonPlankton
Member
 
Registered: Jun 2004
Posts: 129

Rep: Reputation: 15
do a ...

Code:
$ man 5 crontab
that's where I got this info ...

The time and date fields are:

field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)

... so you should execute this command (I hope you know how to use vi)

Code:
$ crontab -e
That will bring up a text editor (vi probably). Depends on what your EDITOR env var. is set to. Anyways enter this ...
Code:
* * * * 0,3 java -jar myFile.jar
To verify that you saved your changes do this ...
Code:
$ crontab -l
 
Old 07-28-2004, 06:11 PM   #3
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Original Poster
Rep: Reputation: 0
crontab -e is that a new file or do I have to go into /etc/ and pull up the cron file?

I understand the rest of the suggestion and thanks a lot for that. I just don't know where to type in the command
 
Old 07-28-2004, 06:30 PM   #4
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
crontab is a wrapper for you to edit your crond files. I suggest you to not play with the files in the /etc because they are system files.
Each user, even root, can have a separated cron file, in the directory "/var/spool/cron". The command "crontab -e" copy this file to a temporary area, calls your preferred editor to edit it, then, when you save your editions, it checks the proper syntax before submit it to the crond.
 
Old 07-28-2004, 06:39 PM   #5
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Original Poster
Rep: Reputation: 0
thanks for that clarification

another question

should my command have 3 asterics or 4 cos I am thinking each asteric stands for a field and there are 5 feilds so something like


***0,3 java -jar Myfile.jar






thanks for all the help
 
Old 07-28-2004, 08:49 PM   #6
SheldonPlankton
Member
 
Registered: Jun 2004
Posts: 129

Rep: Reputation: 15
4
 
Old 07-28-2004, 09:12 PM   #7
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
You're right in your standing. You need to have one asterisk for each "don't care" field but you have to put a space between each field.
 
  


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
Cron Job petenyce Linux - Newbie 5 10-11-2005 04:03 PM
Cron job rajasekarvr Linux - General 4 05-03-2004 05:35 PM
cron job ? johnyy Linux - Software 3 12-10-2003 06:00 PM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM
cron job? luap Linux - Software 2 03-16-2003 08:48 AM


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