Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to run smbmount if and only if a network connection is available...I would like to do that in say .bashrc
how do I disinguish between eth0 being up or not (better yet, if I can identify the WORKGROUP/DOMAIN I am in)
well you don't do that that way anyway, with a line in fstab it will quietly fail if the network if not available.
if you did want it, there are loads of things you could try, such as checking the return status of a single ping to the samba host ( if [ `ping -c1 hostname`]; then ) or grepping the ifconfig output (if [ `/sbin/ifconfig | grep eth0 ]; then ) but there's no need.
the reason I want to do it in a script is that the folder I need to access has two level of access, RW is only available if I use certain username/passwd...so everytime I need to use it (and I use it frequenctly) I need to smbmount ... -o username=xxx
something like that....
I can't do this is fstab caz it doesn't give s*** about smbuser...whatever...
If you can suggest a better way, that'd be great!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.