Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FS refresh script

Status
Not open for further replies.

gringomike

Technical User
Aug 6, 2003
148
GB
Hi folks!

I'm trying to script the refresh of a file system and have compiled the code below. This works fine but for the fact I have to hit the <enter> key once it gets to the /usr/sbin/vxassist -g rootdg make test_fs 1g disk01 line where the script just hangs until the user intervenes:-(

Does anybody know why this is and how I can get around it?

Cheers!

GM




ANS=y

echo &quot;dumping /usr/bin/nsr from JUPITER.....&quot;
rsh jupiter /usr/sbin/ufsdump 0uf venus:/apps/JUPITER_apps/JUPITER_test /usr/bin/nsr
echo &quot;dump of /usr/bin/nsr complete&quot;

echo &quot;unmounting /test_fs.....&quot;
/usr/sbin/umount -f /test_fs
echo &quot;/test_fs unmounted successfully&quot;

echo &quot;re-creating /test_fs file system.....&quot;
/usr/sbin/vxedit -g rootdg -rf rm test_fs
/usr/sbin/vxassist -g rootdg make test_fs 1g disk01
/usr/sbin/newfs /dev/vx/rdsk/rootdg/test_fs |read $ANS
/usr/sbin/mount -o rw /dev/vx/dsk/rootdg/test_fs /test_fs
echo &quot;/test_fs file system re-created&quot;

echo &quot;restoring the /test_fs file system&quot;
cp /apps/JUPITER_apps/JUPITER_test /test_fs
cd /test_fs
/usr/sbin/ufsrestore rf JUPITER_test
/usr/sbin/umount -f /test_fs
/usr/sbin/mount -o ro /dev/vx/dsk/rootdg/test_fs /test_fs
echo &quot;/test_fs file system restored as read only&quot;
 
Do this pipe really work??

/usr/sbin/newfs /dev/vx/rdsk/rootdg/test_fs |read $ANS


tikual
 
Unless vxassist reads /dev/tty instead of stdin, you can try this:
Code:
echo &quot;&quot; | /usr/sbin/vxassist -g rootdg make test_fs 1g disk01

Hope This Help
PH.
 
Hi folks!

Thanks for the replies!

tikual
Yes this does work. I was surprised myself!

PHV
This didn't work i'm afraid. Any other ideas?

GM
 
How would you guys tackle this problem? I don't think I'm far off a working solution but if I can't get this working I might have to abandon it and start from the begining again:-(

GM
 
Ho gringomike
could u pls tell u about ur shell, unix and their version



[ponder]
----------------
ur feedback is a very welcome desire
 
You may consider
Code:
 expect
.

Hope This Help
PH.
 
Thanks for your replies everybody!

I was running the script using /bin/ksh and by changing it to be run by /sbin/sh it completes without a problem.
Expect would have been the next method I would have looked at!

Thanks again!

GM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top