help with aix script please

help with aix script please

am 14.09.2007 11:21:26 von david_humphreys

Hi ,

Hope you can help . I have posted this on the Pick group and to Aix
group without much
success.


My expertise (such as it is) is in D3 and not AIX . Aix is simply
used
as the host o/s.


The scenario is as follows :-


AIX version 5 on RS6000
D3 (PICK) release 7.4.1.RS


Remote login using MPSL and Accuterm telnet.


The user-coldstart includes TRAP DCD EXIT and the account logon proc
includes DCD-ON.


Users login with individual aix profiles which include a d3 -n -
dcdon
command.Where 'n' is the port number for the individual login in the
range 1-300. It appears that despite the above users are not always
logged off completely with the result that the next login results in
the error message


ERROR: PIB nnn is already connected ( pid nnnnn)


A subsequent kill nnnnn clears the problem but this option is not
available to the remote users meaning that the system administrator
needs to deal with these requests ( not very happy with 30+ requests
over the weekend)


Can anyone help with an aix script to examine the aix response , and
if it the above error, to extract the pid and then execute kill (pid
nnnn) before retrying the d3 -n -dcdon command.

Ideally it would be along the lines of

1, Enter command d3 - nnn -dcdon

2. Capture output from the command If successful login then exit
script

3. If error is as above the extract pid number ( 'cut' was suggested
in Aix group)

4. Execute kill nnnn

5 Loop to reenter command ( possibly with a maximum no of retries)


Or is there a better solution?



Best Regards and thanks for your help

Re: help with aix script please

am 14.09.2007 12:13:14 von Janis Papanagnou

On 14 Sep., 11:21, david_humphr...@btconnect.com wrote:
> Hi ,
>
> Hope you can help . I have posted this on the Pick group and to Aix
> group without much
> success.
>
> My expertise (such as it is) is in D3 and not AIX . Aix is simply
> used
> as the host o/s.
>
> The scenario is as follows :-
>
> AIX version 5 on RS6000
> D3 (PICK) release 7.4.1.RS
>
> Remote login using MPSL and Accuterm telnet.
>
> The user-coldstart includes TRAP DCD EXIT and the account logon proc
> includes DCD-ON.
>
> Users login with individual aix profiles which include a d3 -n -
> dcdon
> command.Where 'n' is the port number for the individual login in the
> range 1-300. It appears that despite the above users are not always
> logged off completely with the result that the next login results in
> the error message
>
> ERROR: PIB nnn is already connected ( pid nnnnn)
>
> A subsequent kill nnnnn clears the problem but this option is not
> available to the remote users meaning that the system administrator
> needs to deal with these requests ( not very happy with 30+ requests
> over the weekend)
>
> Can anyone help with an aix script to examine the aix response , and
> if it the above error, to extract the pid and then execute kill (pid
> nnnn) before retrying the d3 -n -dcdon command.
>
> Ideally it would be along the lines of
>
> 1, Enter command d3 - nnn -dcdon
>
> 2. Capture output from the command If successful login then exit
> script
>
> 3. If error is as above the extract pid number ( 'cut' was suggested
> in Aix group)
>
> 4. Execute kill nnnn
>
> 5 Loop to reenter command ( possibly with a maximum no of retries)
>
> Or is there a better solution?
>
> Best Regards and thanks for your help

I don't understand how steps 1. and 2. actually work, but to kill
the processes that are provided in an output stream the following
(untested!) program may do the job.

awk '/ERROR: PIB .* is already connected/'{
sub(/^.*pid /,""); sub(/\).*$/,""); s=s" "$0 }
END { if(s) system("kill" s) }'

To operate on the output of a process call it like

your_process_that_creates_error_messages | awk '...'

or if your error messages are in a file

awk '...' your_error_message_file


Janis