Operating System - HP-UX
1829702 Members
2275 Online
109992 Solutions
New Discussion

Re: running rsh from windows xp

 
joeljoel
Occasional Contributor

running rsh from windows xp

we are running rsh from windows xp pro to hpux 11.00

the exact command is this:
rsh hpux01 -l root /scripts/backup.ksh
which runs the script pasted below.

question: why does the lvsplit fail? when we run this from a normal shell, it works fine ... i thought it may be the env is not (and it may be the case) but when it view the env via "rsh hpux01 -l root env" it looks ok


--v--v--v--v-- snip --v--v--v--v--

#!/usr/bin/ksh

################################################################################
wlog() {
cdhome
echo "`date +%m/%d/%y\ %H:%M:%S` - $*" >> backup.$today.log
}
################################################################################
cdcachesys() {
cd /usr/cachesys
}
################################################################################
cdhome() {
cd /scripts/backup
}
################################################################################
send_wall_msg() {
wlog "========== BEGIN send_wall_msg"
cdhome

wall <<- EOF
System backup will begin in 60 seconds. Log off now or you will be logged off.
EOF
sleep 60
wall <<- EOF
System backup starts now. You are being logged off.
EOF

wlog "========== END send_wall_msg"
}
################################################################################
stop_database() {
wlog "========== BEGIN stop_database"
cdcachesys

wlog " running: ccontrol stop cache"
ccontrol stop cache quietly
wlog " completed: ccontrol stop cache"

if [ "`ps -ef | awk '/[ \t](cache|openm|msqlm|mux)([ \t]|$)/ {print}'`" ]; then
dbpids=`ps -ef| awk '/[ \t](cache|openm|msqlm|mux)([ \t]|$)/ {print $2}'`
wlog " killing processes: $dbpids"
kill -9 $dbpids
fi

if [ "`ps -ef | awk '/[ \t](cache|openm|msqlm|mux)([ \t]|$)/ {print}'`" ]; then
proccount=`ps -ef | awk '/[ \t](cache|openm|msqlm|mux)([ \t]|$)/ {print}' | wc -l | awk '{ print $1 }'`
wlog " WARNING: some processes remain ($proccount)."
fi

wlog "========== END stop_database"
}
################################################################################
start_database() {
wlog "========== BEGIN start_database"
cdcachesys

wlog " running: ccontrol start cache"
ccontrol start cache
startdbstatus=$?
wlog " sleep 30 seconds"
sleep 30
wlog " stop journaling"
/scripts/tools/stop_journaling
wlog " completed: ccontrol start cache; status=$startdbstatus."

wlog "========== END start_database"
}
################################################################################
split_mirrors() {
wlog "========== BEGIN split_mirrors"
cdhome

vol=/dev/vg03/lvol1
mnt="/defgbdebt"
mnts="/mirror/defgbdebt"
splitit

vol=/dev/vg10/lvol10
mnt="/defgbdebt2"
mnts="/mirror/defgbdebt2"
splitit

vol=/dev/vg04/lvol2
mnt="/def"
mnts="/mirror/def"
splitit

vol=/dev/vg05/lvol1
mnt="/art"
mnts="/mirror/art"
splitit

wlog "========== END split_mirrors"
}
################################################################################
splitit() {
wlog " ========== BEGIN splitit ($mnt; $mnts)"
cdhome

wlog " running: lvsplit -s x $vol"
lvsplit -s x "$vol"
lvsplitstatus=$?
wlog " completed: lvsplit -s x $vol; status=$lvsplitstatus"
if [ $lvsplitstatus != 0 ]; then
wlog " WARNING: lvsplit failed."
fi

wlog " running: fsck -y $vol\x"
fsck -y "$vol"x
fsckstatus=$?
wlog " completed: fsck -y $vol\x; status=$fsckstatus"
if [ $fsckstatus != 0 ]; then
wlog " WARNING: fsck failed"
fi

wlog " running: mount $vol\x $mnts"
mount "$vol"x "$mnts"
mountstatus=$?
wlog " completed: mount $vol\x $mnts; status=$mountstatus"
if [ $mountstatus != 0 ] ; then
wlog " WARNING: $mnts not mounted."
fi

wlog " ========== END splitit ($mnt; $mnts)"
}
################################################################################
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# MAIN BACKUP ROUTINE
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
################################################################################

today=`date +%m_%d_%y`
send_wall_msg;
stop_database;
split_mirrors;
start_database;
cdhome
5 REPLIES 5
Peter Godron
Honored Contributor

Re: running rsh from windows xp

Hi,
could you please include a copy of your log messages (wlog) that makes you suspect lvsplit is failing.
joeljoel
Occasional Contributor

Re: running rsh from windows xp

the errors:

splitit[5]: lvsplit: not found
splitit[13]: fsck: not found
splitit[21]: mount: not found

since these are obviously a *simple* pathing issue, i guess i could hardcode the path in the script unless there's a way to source the running user's profile via windows rsh (something like: ". ./.profile" )

also after closer inspection, the "rsh hpux01 -l root env" shows an environment that does not match the normal (telnet) shell (i.e. under sh, PATH=abc:xyz under rsh, PATH=abc)

thanks,
joel
Peter Godron
Honored Contributor

Re: running rsh from windows xp

Hi,
so it seems to be a env problem. Have you tried including your env file into the script?
Torsten.
Acclaimed Contributor

Re: running rsh from windows xp

Please use full path names for clean programming, e.g.:

/usr/sbin/lvsplit
/usr/sbin/mount

to find the binary use "whereis" or "whence"

# whence mount
/usr/sbin/mount

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
joeljoel
Occasional Contributor

Re: running rsh from windows xp

thanks for the help

i specified the path to the bin files and everything is OK

i thought of that before and had not yet tried it primarily because the "env" command via rsh indicated that it would see the bin files

regardless - it's fixed