Operating System - HP-UX
1855766 Members
4259 Online
104103 Solutions
New Discussion

Run limited jobs in parallelism

 
SOLVED
Go to solution
Ulf Sandberg_2
Occasional Contributor

Run limited jobs in parallelism

Hi,

I have have to run more backup scripts in parallel, I start first 4 backups, when any of this backup are finished I want to start the next one in queue. If I am using wait I have to wait for all processes before I can start the next backup i queue.

Is there any method to do this?
4 REPLIES 4
Thierry Poels_1
Honored Contributor
Solution

Re: Run limited jobs in parallelism

Hi,

you could start them all with the at-command. Define a special queue (man queuedefs) for your backups and allow 4 simultanious jobs.

good luck,
Thierry
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Shaikh Imran
Honored Contributor

Re: Run limited jobs in parallelism

Hi,
Why don't u try cron
see man cron for details.

Reg
I'll sleep when i am dead.
KapilRaj
Honored Contributor

Re: Run limited jobs in parallelism

My idea is to have a number of tickets present and whoever got the ticket should be given prevgs to run the job. i.e.,
Have a backup script as follows,

function get_ticket {
SLEEP=YES
while [ $SLEEP = "YES" ]
do
TICKET_DIR=/tmp/tickets
TICKET_FILE=$TICKET_DIR/$0_ticket
TICKET_USED=`ls -l /tmp/tickets |wc -l`
if [ $TICKET_USED -ge 4 ]
then
echo No tickets available now sleeping ...
SLEEP=YES
sleep 900
else
echo There are $TICKET_USED tickets currently used lemme use the next
touch $TICKET_DIR/$0_ticket
SLEEP=NO
fi
done

}

function backup {

BACKUP_SCRIPT #Execute the backup commands

}

function release_ticket {

echo $0 Backup is complete lemee release the ticket
rm $TICKET_FILE
if [ $? -ne 0 ]
then
echo Unable to release ticket $TICKET_FILE
fi
}

# Do the actual stuff
get_ticket
backup
release_ticket

Regds,

Kaps
Nothing is impossible
Ulf Sandberg_2
Occasional Contributor

Re: Run limited jobs in parallelism

Thank you, it has solve my problem