- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script Help.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:07 AM
06-19-2002 08:07 AM
Script Help.
We have a script to push the homedir's for nis and runs on the master server. There is this portion of the code i am having problem with. It reads a hosfile and pushes the dir's to them. This is the hostfile
MASTER=tx274
SLAVE1=tx275
SLAVE2=tx276
SLAVE3=tx277
I have attached the portion of the script which does the pushing of the dir's which doesn't function. I think this was written with one SLAVE entry in the above hostfile.now we have 3 entries. Can someone help please?
Thanks
Joe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:16 AM
06-19-2002 08:16 AM
Re: Script Help.
Try this changes:
for cur_line in hostfile |
do
if `echo ${cur_line} | grep "^SLAVE" > /dev/null`
then
SLAVE=`echo ${cur_line}| cut -d"=" -f2`
remsh ${SLAVE} hostname > /dev/null
if test $? -eq 0
then
echo "Copying password file to the Slave - $SLAVE."
rcp ${PASSWD} ${SLAVE}:${PASSWD}
else
echo "\n\n\t\tUnable to reach the Slave - ${SLAVE}.\n\n"
fi
fi
done
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:18 AM
06-19-2002 08:18 AM
Re: Script Help.
Sorry a mistake:
for cur_line in hostfile |
do
This is the good lines:
for cur_line in hostfile
do
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:24 AM
06-19-2002 08:24 AM
Re: Script Help.
tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:30 AM
06-19-2002 08:30 AM
Re: Script Help.
#!/usr/bin/ksh
PASWD=/etc/passwd
for line in $(cat hostfile)
do
slaveyn=$(echo $line | awk -F"=" 'BEGIN{f=0}; $1=/SLAVE/{f=1}; END{print
f}')
host=$(echo $line | cut -d"=" -f2)
if [ $slaveyn -eq 1 ]
then
remsh $host /usr/bin/hostname >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Copying password file to slave - $host"
rcp ${PASWD} $host:${PASWD}
else
echo "unable to reach slave $host"
fi
fi
done
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:33 AM
06-19-2002 08:33 AM
Re: Script Help.
in awk statement I mean ... $1~/SLAVE/{.... not =
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 08:52 AM
06-19-2002 08:52 AM
Re: Script Help.
I am still getting only tx277 as $SLAVE. Will that help. I think it should capture all the 3 slaves and that was the problem.
Thanks
Joe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 10:23 AM
06-19-2002 10:23 AM
Re: Script Help.
Try this.
#!/usr/bin/sh
grep ^SLAVE hostfile | while IFS='=' read junk slave comment
do
if remsh $slave hostname 0<&- 1>&2
then
echo "Copying password file to slave $slave."
else
echo "Unable to reach slave $slave."
fi
done 2> /dev/null
Notice that we are closing stdin to remsh; Otherwise it will slurp up the rest of the grep stream.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 10:25 AM
06-19-2002 10:25 AM
Re: Script Help.
Oh, I forgot the `rcp /etc/passwd ${slave}:/etc/passwd` part... Sorry.