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!

I need a script that does the following

Status
Not open for further replies.

EntilzaSte

Technical User
Jun 20, 2001
73
GB
Hi,

I need a unix script that will test if a file mount is active BEFORE it begins copying files... I know the basic layout of what I want so heres my psuedocode....

(nb I only use touch as I know what it does. If theres a better way......)

if (touch /MOUNTED_DRIVE/FILENAME = Success) then
cp file /MOUNTED_DRIVE/.
else
echo "It failed contact IT"
endif


Many thanks

 
possibly easier to put a file on the mounted system somewhere you know, and then from your script

if [ ! -f /path/to/mounted/system/filename ] ; then
Echo Filesystem ?? not mounted, please mount before file copying|mail -s"Filesystem not mounted" it@yourplace.com
else
cp files /where/you/want/em
fi ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
You could always grep /etc/mtab and see if your drive is mounted that way.
 
KarveR, Many thanks it works a treat now... [2thumbsup]

Best wishes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top