LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-19-2005, 02:32 PM   #1
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Rep: Reputation: 0
Question want to run program every minute, crontab????


I have a java program that talk to database. I want this program to run every minute. I plan to use crontab but worry about the new job will start when the old one is not finish. Should I use crontab for this case? Anyway to make sure that only one process running on system?
 
Old 09-19-2005, 02:36 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
The easiest way would just be to loop one proccess with a pause after it completes each task.

If you want to launch a new proccess each time then using a check file would probably be sufficient.
 
Old 09-19-2005, 02:42 PM   #3
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by david_ross
If you want to launch a new proccess each time then using a check file would probably be sufficient.
how to using a check file with crontab? you mean create a file when start process and delete it at the end of process?

Last edited by poj; 09-19-2005 at 02:50 PM.
 
Old 09-19-2005, 02:59 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Quote:
Originally posted by poj
you mean create a file when start process and delete it at the end of process?
Yes, obviously check that it doesn't already exist before creating it. If it does exist then you can either loop until it is deleted or just exit.
 
Old 09-19-2005, 05:29 PM   #5
Vgui
Member
 
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31
As usual, scripting is the answer. You could throw your java start command in a for loop, sleep in between for a bit, and reloop if the last one is done. Sort of like:
Code:
for infinite (or maybe time limit)
java && sleep 1000
That way the java program will finish executing, then a sleep will happen. You could also do "java ; sleep 1000", to make sure the sleep always happens, even if the java program gives an unusual exit signal.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What does the run-parts mean in crontab? mTorbin Linux - Newbie 15 04-27-2012 04:53 PM
crontab and run-parts gavinbeatty Slackware 4 09-13-2005 07:56 PM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 04:42 AM
How to run useradd from crontab? adrianphicks Linux - Enterprise 3 08-03-2004 01:00 AM
Can't run F-Prot with Crontab maxflex Slackware 7 07-31-2004 11:11 AM


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

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