LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 08-26-2002, 01:10 AM   #1
mathfeel
Member
 
Registered: Feb 2002
Distribution: Gentoo
Posts: 95

Rep: Reputation: 15
networking


I would like to write a script that should on lauch if network is available...how do I check that with a shell script???
 
Old 08-26-2002, 10:43 AM   #2
abrakadabra
Member
 
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109

Rep: Reputation: 16
Hi mathfeel,
what exactly do you have in mind? what are you trying to accomplish? can you be more specific?
 
Old 08-26-2002, 11:49 AM   #3
mathfeel
Member
 
Registered: Feb 2002
Distribution: Gentoo
Posts: 95

Original Poster
Rep: Reputation: 15
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)
 
Old 08-26-2002, 11:54 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 08-26-2002, 12:13 PM   #5
mathfeel
Member
 
Registered: Feb 2002
Distribution: Gentoo
Posts: 95

Original Poster
Rep: Reputation: 15
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!
 
Old 08-26-2002, 12:40 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
i just DID....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration