LinuxQuestions.org
Review your favorite Linux distribution.
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 12-14-2006, 10:55 PM   #1
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 226

Rep: Reputation: 30
time control process


I am coding shell scripting in linux , is thr any method so that i can run a command for a specific time then another for a given time in rotration..like thereading in java. sm process control.
 
Old 12-14-2006, 11:05 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
What sort of time resolution do you need - microseconds, seconds, minutes?
 
Old 12-15-2006, 05:41 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You can use a 'while' loop and put inside a 'sleep' command or parse the output from the 'date' command before starting a new process. Or you can wait until the previous process has terminated by the construct:

<the_process_to_launch> &
pid=$!
wait $pid

A better chance would be Python and the 'thread' module.

Bye
 
Old 12-15-2006, 08:25 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
@colucix: I thought sunlinux meant cycling between two or more processes, putting putting all but one into a stopped state while one runs.

@sunlinux: if that is what you mean, you can probably do it with shell scripts, but it'll be a little ugly. You'll have to start several processes in the background (using the & symbol at the end of the command), then send signals with the kill command. SIGSTOP will stop a process running, SIGCONT will wake it up again. You can sleep between the swap over operation with the sleep command, but the resolution is 1 second, hence my original question.
 
Old 12-16-2006, 08:44 PM   #5
discuss
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
what i understand according to your question, use at, cron...
 
  


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
Control amount of time a user may be logged in. (Parental Control) darrensnospam Mandriva 13 02-18-2006 05:01 PM
Process Table-Process Control Block sarahmencer Linux - General 1 01-09-2006 09:14 PM
Process control...? kleptophobiac Linux - General 2 09-25-2004 10:03 AM
Quick process control question gauge73 Linux - Newbie 2 03-18-2004 12:37 PM
Regaining Process Control mikeyt_333 Linux - General 5 03-21-2002 02:21 PM


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