Set limit on jobs based on process name?

Discussion in 'Server Operation' started by davefrooney, Apr 8, 2011.

  1. davefrooney

    davefrooney Member

    Hi,

    I am looking to limit the number of concurrent jobs run based on process name.

    I am running audio conversion on a server using pacpl with the following script but it isnt limiting jobs like i want it to.

    Code:
    #!/bin/bash
    
    num_jobs = 13
    while [ $(ps -A | grep -v grep | grep -c pacpl) -ge $num_jobs ]
    do
            sleep 1
    done
    
    pacpl -t mp3 --outdir /my/out/dir $1 >> /var/log/pacpl/34.log &
    
    Any help would be greatly appreciated
     

Share This Page