Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

(none)

1 view
Skip to first unread message

Matthew....@nl.abnamro.com

unread,
Jun 26, 2000, 3:00:00 AM6/26/00
to

Apologies for replying to the list, but I'm surprised no one
else replied with this entry from the UNIX FAQ.
(http://www.faqs.org/faqs/unix-faq/faq/part3/)

You can get the "ersh" mentioned below from
http://www.leo.org/pub/comp/usenet/alt.sources/ersh/

This is in fact quite a difficult problem to solve in
the right way, and it would be difficult to improve
on ersh!

Regards,
-Matt

Subject: How do I check the exit status of a remote command executed via "rsh"?
Date: Thu Mar 18 17:16:55 EST 1993

3.11) How do I check the exit status of a remote command
executed via "rsh" ?

This doesn't work:

rsh some-machine some-crummy-command || echo "Command failed"

The exit status of 'rsh' is 0 (success) if the rsh program
itself completed successfully, which probably isn't what
you wanted.

If you want to check on the exit status of the remote program,
you can try using Maarten Litmaath's 'ersh' script, which was
posted to alt.sources in October 1994. ersh is a shell script
that calls rsh, arranges for the remote machine to echo the
status of the command after it completes, and exits with that
status.


kn...@cwcom.net on 23/06/2000 18:08:39

To: hpux-...@dutchworks.nl
cc: (bcc: Matthew Hannigan/NL/ABNAMRO/NL)
Subject: [HPADM] [SUMMARY] Q: Scripting problem with remsh return code or exit
code

I had three answers to this query! May I take the opportunity to give my
special thanks to David Ledger for his answer into solving my problem.
----
David Wrote:
I think:
s1=$(remsh nodeB -n "/opt/perf/bin/mwa status 1>&2 ; echo $?" 2>logfile)
should work. The remote text reply comes back on stderr & thence
into the log file. The remote status goes into s1 via stdout.
----
I would further like to thank Alan Riggs who was quick to respond with:-
remsh nodeB -l root -n '/sbin/vgchange -a n /dev/vg101 ; echo $?' >>$logfile
2>&1
s1=$(tail -1 $logfile)
----

There seem to be numerous ways but I wanted to keep to strict rules and the
other methods researched by yourselves, my collegues and I always involved
lots of additional un-necessary coding. I wanted to segregate the control
from the textural and David's answer gave that.

The most intrinsic procedure we came up with was as follows:

func() {
set -A array $(remsh nodeA -l root -n '/opt/perf/bin/mwa stop ; exit " #$?"'
| tr "\n" "#" )
return_code=$(echo ${array[$(( ${#array[@]} - 1 ))]} | sed 's/#//g')
unset ${array[$(( ${#array[@]} - 1 ))]}
echo ${array[*]} | tr '#' '\n' >> ${logfile}
exit ${return_code}
}

I don't know whether I've typed this in full correctly but essentially our
trials worked. Limitations are the 1024 elements in the array but it did
allow us keep output and return codes separately without using destructive
commands and all in memory too.

See it only goes to prove you can look too deep in the Lions den.
Simplicity is best

ORIGINAL QUESTION

Hi Admins,
I'm in the middle of a scripting problem and wonder if anyone out there can
further oblige. I've checked the archives and found a few responses to
previous cries for help but they're short of what I'm trying to achieve.

I have 3 systems (nodeA, nodeB and nodeC) and I want to write a single
stream script on nodeA to query nodeB, nodeC before I execute on
nodeA.
Lets provide a bit of code for an example.

s1=$(remsh nodeB -l root -n '/opt/perf/bin/mwa status ; echo $?')

this directs all of the output from mwa and the return code. I'm only
nterested in the return code in s1 but want the output of the status in a
local log file. So I thought I'd re-direct stdout to a log file held
locally:-

s1=$(remsh nodeB -l root -n '/sbin/vgchange -a n /dev/vg101 ; echo $?'
1>>$logfile 2>>$logfile)
however, s1 no longer holds a value because echo $? has gone to stdout

A previous solution suggests 'echo $? > /tmp/$mypid' and then use and remove
that but, I do not like the idea of using 'rm' in a script on another
system.

You will note that I've changed the commands in the remsh and thats' because
I've got plenty to stop MWA, unmount a filesystem and deactivate the volume
group. Why? is not important but the single stream is.

Can any one enlighten me or suggest an alternative route please?

--
---> Please post QUESTIONS and SUMMARIES only!! <---
To subscribe/unsubscribe to this list, contact majo...@dutchworks.nl
Name: hpux-...@dutchworks.nl Owner: owner-hp...@dutchworks.nl

Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only)
http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)


--
---> Please post QUESTIONS and SUMMARIES only!! <---
To subscribe/unsubscribe to this list, contact majo...@dutchworks.nl
Name: hpux-...@dutchworks.nl Owner: owner-hp...@dutchworks.nl

Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only)
http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)


Miller, Mike E

unread,
Jun 26, 2000, 3:00:00 AM6/26/00
to
Hi All,

Thanks to everyone for their quick help !!!

What I needed to do was use the pfs_mount.


============= Summary =====================================
I used the script below to solve my dilemma :


nohup /usr/sbin/pfs_mountd &
nohup /usr/sbin/pfsd &
/usr/sbin/pfs_mount -v -x unix /dev/dsk/c0t2d0 /cdrom


I tried using the : mount -o cdcase /dev/dsk/c0t2d0 /cdrom
command but the file ownerships were messed up when I did it. It did
fix the ";1" problem though.

============== Original Question ==============================
> -----Original Message-----
> From: Miller, Mike E [SMTP:mike.e...@nspco.com]
> Sent: Monday, June 26, 2000 11:02 AM
> To: 'hpux-...@dutchworks.nl'
> Subject: [HPADM] Mounting CD with ";1" problem
>
> Hi All,
>
> I've mounted a CD from a 3rd party VAR and it has all of the file names as
> upper case and with trailing a ";1" on each of the filenames. I've heard
> of
> this problem before but missed the summary on how to fix it, anyone still
> have the memo or know how to fix the problem ?
>
==========================================================

Roberto Retta

unread,
Jun 28, 2000, 3:00:00 AM6/28/00
to
I have the same problem........

Robert

-----Mensaje original-----
De: CHAN,JIMMY-SM (A-Singapore,ex1) [mailto:jimmy-...@agilent.com]
Enviado el: Martes 27 de Junio de 2000 21:58
Para: 'hpux mailing'
Asunto: [HPADM] Telnet to HPUX Workstation Using Reflection1 !!!
Urgent!!!!
Importancia: Alta


Hello guys,

I have tried to use to install Reflection 1 into my Windows OS and use this
reflection to dial into a hpux (Ver 10.2) workstaion. But I saw garbage on
my
PC. It seen to me that the settings on my Reflection 1 is wrong. Please
enlighten me on this (handshaking mode, data speed ...etc).

On my workstation, I have already configured the modem as a dial in modem.
Should I run any daemon my hpux workstatiion ??????


Please help....

Thanks & Regards,
Jimmy-SM Chan
jimmy-...@agilent.com
Agilent Technologies (Sales) Singapore

Ayson, Alison {Info~Palo Alto}

unread,
Jul 1, 2000, 3:00:00 AM7/1/00
to
Ok..I've really screwed up I think.

I have an HP K450 running 10.20. This K450 is connected to an EMC box. I
have both HP Mirroring software and EMC timefinder software. We were
running out of space on a particular volume group (/dev/vg01) so we added
more disks to our EMC box. /dev/vg01's current configuration is 10x4 gig
drives. We added 18 gig drives to our EMC using a 2:1 split. So the K450
see's an additional 12x9 gig drives. I had intended to add 6 of the 9 gig
drives to /dev/vg01 and use the remaining 6x9 gig drives as BCV's. Stupidly
I forgot that since the current volume group was created with 4 gig drives
it will only see 4 gigs of the 9 gig drives I'm trying to add to it due to
Max PE per physical volume.

I've created a brand new volume group with 6 of the 9 gig drives and I'm
copying /dev/vg01 (using cpio) to this new volume group. Then I think I'll
have to destroy /dev/vg01 and then add it's 4 gig drives to the new volume
group. This is going to take forever since I have 42 gigabytes to copy!

It seems like there's got to be a better way. I wondered if there was
anyway to use MirrorUX to achieve the copy...but I don't think so. The only
way to use mirroring would be to add the 6x9 gig drives to /dev/vg01, mirror
the logical volume and then do an lvsplit. However when I try the 9 gig
drives to /dev/vg01 only 4 gigs will be seen..so there goes that solution.

Then I was wondering if I could use timefinder to achieve a copy. Do an BCV
establish to create my third mirror, then do a BCV restore to the six 9 gig
drives. However I think that the BCV restore would also restore the volume
group information (including MAX PE per PV) and I'd be in the same boat.

Anyone out there have any ideas??? I think I'm stuck here until
2:00am........sigh.


--- Alison

0 new messages