Operating System - HP-UX
1836462 Members
2100 Online
110101 Solutions
New Discussion

prob with sh or swinstall in nohup script

 
Nivesh Patnaik
Frequent Advisor

prob with sh or swinstall in nohup script

I am trying to install a telnetd patch from a script. The parent script calls a child script with nohup. The child script kills all telnet sessions, including the tty session which I used to invoke the parent script. The child script then proceeds to shar and swinstall the depot file.

The problem I am noticing is that either the sh or the swinstall fails. swinstall.log says:
ERROR: The match operation failed. No software from the target was
matched on the source.
ERROR: Cannot continue the "swinstall" task.
* Selection had errors.

However, when I comment out the code in the child script that kills the telnet sessions, the patch gets installed correctly.

I have made sure that PATH is set properly in the child script.

Why does swinstall in the nohup child script fail if the parent script that spawned the child script is killed, by virtue of all telnet sessions being killed?

Thanks,
--Nivesh
I gave him his drink as usual. Some men can't hold their arsenic.
9 REPLIES 9
Sridhar Bhaskarla
Honored Contributor

Re: prob with sh or swinstall in nohup script

Hi Nivesh,

That's an interesting situation. May be the patch is looking for live telnetd sessions to ensure it's compatibility.

What is happeneing if you keep the same kill telnet sessions except for the one you are using. Just curious.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: prob with sh or swinstall in nohup script

I'd like to see th swinstall command line you are using.

You could log on at the console and try it there, that might get you around the install process suicide problem.

P
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Nivesh Patnaik
Frequent Advisor

Re: prob with sh or swinstall in nohup script

I have run the scripts from the console and gotten the same errors, which is puzzling because:
1) HP recommends in the installation instructions that all telnet sessions be closed prior to installing the patch
2) If I am running it at the console, it shouldn't matter that I am killing telnet sessions as my session is not affected.

I do shutdown inetd before I start the install, but it shouldn't be a factor as I have successfully installed without inetd running.

I use:
swinstall -x autoreboot-true -x match_target=true -s /tmp/PHNE_24821.depot

I changed the child script such that it kills all other telnet sessions, except for the tty session associated with the nohup child script. The patch gets installed without errors!

I have not tried it yet, but I think it should now work from the console also. I will post another message with the result. But I am not satisfied with this workaround.

The reason why I need the install to work both from the console and from a telnet session is that, some systems do not have a keyboard and monitor attached.

Is it really okay to install PHNE_24821 which puts out a new /usr/lbin/telnetd while there are active telnet sessions to the system? Sure, the install works that way, but why does HP recommend otherwise?
I gave him his drink as usual. Some men can't hold their arsenic.
Nivesh Patnaik
Frequent Advisor

Re: prob with sh or swinstall in nohup script

There was a typo in my last message. I use:
swinstall -x autoreboot=true -x match_target=true -s /tmp/PHNE_24821.depot
I gave him his drink as usual. Some men can't hold their arsenic.
Nivesh Patnaik
Frequent Advisor

Re: prob with sh or swinstall in nohup script

Update...

step1: I ran the parent script from the console, and swinstall had the error.

step2: Next, I changed the parent so it calls the child script without a nohup, and ran the parent from the console. Failed on swinstall.

step3: Next, I changed the child script and commented out the kill statement, and ran the parent from the console. Patch installs!

None of this is making much sense. Why is the killing of telnet sessions of consequence when I am running the parent at the console. Even more bothersome, there weren't even any telnet sessions to kill, and it still failed at the console(step2).
I gave him his drink as usual. Some men can't hold their arsenic.
James Odak
Valued Contributor

Re: prob with sh or swinstall in nohup script

a guess, but how is that script killing telnet sessions? perhaps it is killing your swagentd process as well?

Just a guess
Jim
Nivesh Patnaik
Frequent Advisor

Re: prob with sh or swinstall in nohup script

I'm not sure if this is the best way, but here is what I came up with to kill all telnet sessions save for the one on which the mother script is being run...

thisTTY=`tty`
thisTTY=`basename $thisTTY`
echo "Killing all telnet sessions except this one" >>$LOGFL
ps -ef |grep telnetd |grep -v $thisTTY |grep -v grep >/tmp/$$.tmp
echo "Active telnet sessions:" >>$LOGFL
cat /tmp/$$.tmp >>$LOGFL

while read v1 v2 v3
do
echo "Killing $v2" >>$LOGFL
# echo "Kill commented out" >>$LOGFL
kill -9 $v2
done
I gave him his drink as usual. Some men can't hold their arsenic.
Sridhar Bhaskarla
Honored Contributor

Re: prob with sh or swinstall in nohup script

As I indicated before, it indicates that this patch may be looking for running telnetd sessions. So obviously you cannot install it in single user mode. HP may come up with some suggestions here too.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Jon Hansen_1
Advisor

Re: prob with sh or swinstall in nohup script

I have run into this for telnet sessions. It has to do with the fact that swinstall likes to run as an interactive shell.

Try:
/usr/sbin/swinstall -s ${PATHTOFILE}/${FILENAME} \*

If the patch requires an auto-reboot the machine will bring itself down without you telling it. Sometimes it will install and work without a reboot. Personnally I would rather install the patch and reboot only if necessary.

Remember the \* installs all components without any questions. This is not safe for those un-familiar in this kind of thing.

Good luck -Jon