You run your function in the background. After that starts, you sleep 5 seconds, then kill it with %1. Then call wait.
The wait will complete when all sub-processes have finished. The kill will silently fail if the job completes first.
Hope this helps.
=======================
Thanks a lot...
I tried this as follows.. But it is not working..
-------------------------------------------------
#scipt name: fun
f()
{
enccp -c mas start service_name -v -myPwd password
# This is a IBM-encina command that is creating the sevice.. Which is hanging in this case
}
f &
x=`jobs -p`
{ sleep 1; kill $x; } &>/dev/null &
wait $x
date
OUTPUT:
------------------------------------------------------
[/home2/niroj_p]./fun
Wed Sep 10 11:28:59 IST 2008
[/home2/niroj_p]starting service_name
retrieving attributes of object service_name ... done
setting up the server resources
retrieving node object mars6 ... done
creating file system path /var/opt/encina/local/subsys/encina/css6/server/service_name... exists
retrieving encina server group name ... done
retrieving encina administration organization ... done
.................
...........................Then it is hanging as usual
I have a file with the record of person:
cat > $TMP/record.txt
John Torres M Single 102353 Address
Mark Santos M Maried 103001 Address
Carla Maria F Maried 125653 Address
#!/bin/ksh
ManipulateID(){
...
return 0;
... #or
return 1;
}
cat $TMP/record.txt | awk 'BEGIN {printf... (4 Replies)
Hi,
I have searched the web and have come back with nothing that is satisfactory for what I require. SFTP is my corporations new file transfer standard. What I require is a method to lock down SFTP users to their directory (they may go to sub directories) while not restricting regular users. ... (2 Replies)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Hi all
Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Hi,
I have a sub function called pressEnter within my perl menu script which basically means that the script will await an interaction from the user before moving on.
Unfortunately when the script goes into pressEnter it just hangs (even if you press enter!!).
Any ideas on what could be... (4 Replies)
I have the following code and want to update shiftDesc inside the function. Is it correct to declare the argument as:
int shiftDesc
void prValue_vd(
FILE* stream, // name of output stream
int shift, // amount of shift to the right
const char* value,... (1 Reply)
I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off....
I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
Hi,
I am having script which contains many functions. Need to print each function name at the starting of the function. Like below,
functionname()
{
echo "functionname"
commands....
}
I've tried like below,
func=`grep "()" scriptname | cut -d "(" -f1`
for i in $func
do
nawk -v... (4 Replies)