Operating System - HP-UX
1847799 Members
2690 Online
104021 Solutions
New Discussion

Re: How to create Multiple commands from Shell script

 
Tony Williams
Regular Advisor

How to create Multiple commands from Shell script

I need to create a script for a test that will simulate create multiple processes at the same time. In this case it would be the OpenView opcmsg command. I need to create several dozen opcmsg commands at the same time.

Is there a way inside a shell script to create say 40 opcmsg's at the same time.

Unfortunately all of the looping facilities inside a shell script do not create them fast enough.
5 REPLIES 5
Uday_S_Ankolekar
Honored Contributor

Re: How to create Multiple commands from Shell script

Hello,

#!/bin/ksh
ftp -n << FTP
user
bin
prompt
mput *
FTP

-USA..
Good Luck..
Uday_S_Ankolekar
Honored Contributor

Re: How to create Multiple commands from Shell script

Sorry wrong post..!!
Good Luck..
Sridhar Bhaskarla
Honored Contributor

Re: How to create Multiple commands from Shell script

Hi Tony,

One idea that struck me is to use at command. Use the same shell script but instead of running them together, schedule them all together at the same time.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Tom Jackson
Valued Contributor

Re: How to create Multiple commands from Shell script

When you loop through build a command that looks like this:

opcmsg & opcmsg & opcmsg & ...

I would try to stack 40 of these in one command line. They should execute asynchronous.

Tom
Volker Borowski
Honored Contributor

Re: How to create Multiple commands from Shell script

Sorry,

I think the expense of creating a new process and switch it to the CPU will always last too long, so you will not be able to "flood" messages with creating processes, that send omne message each.

There has to be a lib and a header file and a documentation and may be with a twentyliner in C you will be able to create a single (or five) process(es) and call the message-call in a loop, which will be fast enough to simulate many messages.

Hope this helps
Volker