It is currently Tue, 17 May 2022 17:42:51 GMT

Author Message
 limiting process time

  Is it possible, in Solaris, to limit the time one certain process has to
run (example, after 10 minuts the process will die) ?


    Marco Gouveia

 Mon, 13 Oct 2003 17:46:47 GMT   
 limiting process time
You could write some sort of script to controll the process, and call the
process, like this:

--------------------------- snip ------------------------------------

# Kills the program chosen by $1
# Usage: <program to run>

# Amount of seconds to wait before killing the process.

# Options for kill- for hard to kill programs

# Start the program in the background
$1 &

# Wait for a user selected amount of time
sleep $wait

# Kill the background process using any required options.
kill $options $!

--------------------------- snip ------------------------------------

Obviously a lot more could be done to make it a great script, but it should take
care of a few situations.  The only trick here is the $! variable, which is the
PID of the most recent background job.

Hope it helps,


 Mon, 13 Oct 2003 18:57:03 GMT   
 limiting process time

With ksh, hard and soft cpu limits can be set by the ksh shell build-in
ulimit command :

ulimit -St 120 # soft process limit 2 minutes.

The command is described in the ksh man pages : man ksh

ksh is normally distributed by Sun, so the command should
work that way, but as I do use Solaris for long now, I can't
be sure 100% ...


 Tue, 14 Oct 2003 08:43:38 GMT   
   [ 3 post ] 

Similar Threads

1. Limiting Process Time or File Size Under Apache?

2. How to limit cpu time per process per user account

3. How to limit cpu time per process per user account

4. Limit cron's process time, etc.

5. setting maximum time limit of process?

6. Setting a time limit on a child process

7. limit subshell processing time ???

8. Time limits on processes?

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software