1829012 Members
2284 Online
109986 Solutions
New Discussion

HP forward mail function

 
SOLVED
Go to solution
Barbara Kramer
Frequent Advisor

HP forward mail function

Hi,
I wrote a script for mail forwarding. Now I need a fuctionality like lockfile (linux) for HPUX. That function waits until one process is done, before another one can start.
Does anyone have any idea?
Thanks for any help
Barbara
live is great !!
4 REPLIES 4
spex
Honored Contributor

Re: HP forward mail function

Barbara,

There are a few ways to accomplish what you want. Depending on how your script is written, you may be able to take advantage of the 'wait' command. 'wait' waits for background processes (executed with '&') to complete before continuing execution.

For example:

cmd1 &
cmd2 &
wait
cmd3

'cmd1' and 'cmd2' are run in parallel. 'cmd3' won't be executed until 'cmd1' and 'cmd2' have completed.

Or you could simulate a lockfile by having the first process create a temp file, and blocking execution of the second process as long as that lockfile exists.

PCS
lawrenzo_1
Super Advisor
Solution

Re: HP forward mail function

here is a little something I use to ensure only one sessionis running

# check to ensure there is only one user running this script:


MYPID=$$
print $MYPID > /tmp/pid.lck

if [[ -f /tmp/pid.lck ]]
then
exit 1
else
continue
fi

then last command of script rm $MYPID
hello
Barbara Kramer
Frequent Advisor

Re: HP forward mail function

Hi,
the skript worked great !! thanks so much
smiles
Barbara
live is great !!
Barbara Kramer
Frequent Advisor

Re: HP forward mail function

Just used the solution provided. Thanks again
live is great !!