This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: different mount table per bash session


Saber,

I had the same problem.

     >>hi there ,

     >>I'm using cygwin bash to run many TCP/IP servers on the same host
     >>machine , i need each server to work with a separate drive ,  so
each
     >> time i start a server the first thing i do is to mount
automatically
     >> its corresponding  drive , but the result is that the latest mounts

     >> suppress the previous one , so i have allways the same drive for
all
     >> my servers.

     >> any help ?

     >> Best Regards.

     >>Saber.

My solution uses the following saved as
"/usr/bin/GetNumberRunningInstances"


<Start Of Script>
#!/bin/bash
#The "/usr/bin/GetNumberRunningInstances" script

let TheInstanceNumber="$(/usr/bin/ps -ef | /usr/bin/gawk -F ' ' ' BEGIN {
TheCount = 0; } { if (($3 == 1) && ($6 == "/usr/bin/bash" )) then
TheCount++;} END { print TheCount }')"


/usr/bin/echo "${TheInstanceNumber}"

# End-Of-Script.
< End of Script>

To use I then use a a file in /etc/profile.d/

containing the lines:

let NewInstanceNumber="$(/usr/bin/GetNumberRunningInstances)"

/usr/bin/echo ""
/usr/bin/echo "NewInstanceNumber: '${NewInstanceNumber}'"
/usr/bin/echo ""

if [ ${NewInstanceNumber} -eq 1 ]
then
   /usr/bin/echo "<Start>    Mounting User Drives ..."
   /usr/bin/echo ""

   <<mount drives>>
   /usr/bin/echo ""
   /usr/bin/echo "<Finished> Mounting User Drives ... continueing ..."
else
   /usr/bin/echo "Not Re-Mounting User Drives - Already Mounted ...
continueing ..."
fi

/usr/bin/echo ""

That got around the problem for me.

--------------------------------
Alan Miles



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]