LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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


Reply
  Search this Thread
Old 07-03-2008, 04:31 AM   #1
djfog
Member
 
Registered: Jun 2008
Distribution: Linux Mint 4.0(Daryna)
Posts: 31

Rep: Reputation: 15
Simulate a process


Hi to all Linux Users.I'm looking for commands for process management,as an example a command to simulate a process for 60seconds,a command to pause a process and one to restart it...something like that..
Thanks in advance.
 
Old 07-03-2008, 08:36 AM   #2
clvic
Member
 
Registered: Feb 2008
Location: Rome, Italy
Distribution: OpenSuSE 11.x, vectorlinux, slax, Sabayon
Posts: 206
Blog Entries: 2

Rep: Reputation: 45
I assume you already know how to use "bash", otherwise it's better for you to read something about that.
I'll give you some suggestion, as the topic of process management is quite wide.

One of the simplest processes I know can be created by making use of the command "sleep".
Try "sleep 1h" to start a long 1h sleep, use "sleep 1h&" to start it directly in the background.
Then, by issuing "kill -SIGSTOP %1" you can stop the job containing "sleep", and analogously by "kill -SIGCONT %1" you can resume it.
Using the command top, you can monitor how many processes are running or stopped, so you'll see changes in the number of stopped processes as you play with these commands... I hope this is of some help!
 
Old 07-03-2008, 12:09 PM   #3
kenoshi
Member
 
Registered: Sep 2007
Location: SF Bay Area, CA
Distribution: CentOS, SLES 10+, RHEL 3+, Debian Sarge
Posts: 159

Rep: Reputation: 32
Quote:
Originally Posted by djfog View Post
Hi to all Linux Users.I'm looking for commands for process management,as an example a command to simulate a process for 60seconds,a command to pause a process and one to restart it...something like that..
Thanks in advance.
Not sure what you mean by "simulating a process".

To restart a process, if its associated with a corresponding service, you should be able to just do a:

service stop <servicename>
service start <servicename>

Some processes/programs you can just send a:

kill -HUP <processid>

To restart it. See documentation for associated process/program.

If all else fails, just do it the old fashioned way...find the pid and kill it, then start the program again.

You can find the processid with:

(old school)
ps -ef | grep <name or command>

or

ps -aux | grep <name or command>

or better yet

ps -fC <name or command>

To pause a process:

kill -s SIGSTOP processid

or

kill -STOP <processid>

To continue a process:

kill -s SIGCONT <processid>

or

kill -CONT <processid>

I'm sure some of the other gurus have additional tips and tricks to add to this, but this should get you started. Hope this helps.
 
Old 07-03-2008, 12:16 PM   #4
djfog
Member
 
Registered: Jun 2008
Distribution: Linux Mint 4.0(Daryna)
Posts: 31

Original Poster
Rep: Reputation: 15
Thanks both of you for your help.I did exactly what I wanted.
 
  


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
Simulate right-click? General Linux - Software 3 05-07-2007 08:06 PM
How to simulate a keypress.. fw12 Linux - General 1 11-13-2006 03:13 PM
How to simulate out of memory errors? lowpro2k3 Programming 8 10-21-2005 04:47 PM
Simulate a CDROM fiod Linux - General 4 02-12-2005 07:47 PM
simulate worm traffic zuessh Linux - Security 3 12-03-2004 10:03 AM

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

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