LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-28-2004, 01:06 PM   #1
bluefire
Member
 
Registered: Oct 2003
Distribution: Mandrake 10
Posts: 160

Rep: Reputation: 30
network up/down script


This allows all users who are given permission in sudoers to take the network up and down with a quick command, without logging in as root.

Call it int, and stick it in /usr/bin


Code:
#!/bin/sh

testIfUp() {
        sudo /sbin/ifconfig | awk 'BEGIN {found = 0} 
                /^eth0/ {found=1}
                END {printf("%s",found)} '
}

FOUND=$(testIfUp)

if [ $FOUND -eq 0 ] 
then
        echo Bringing up
        sudo /sbin/ifup eth0
else
        echo Taking down
        sudo /sbin/ifdown eth0
fi
 
Old 09-04-2004, 03:29 AM   #2
zatriz
Member
 
Registered: Aug 2003
Location: Seattle, Wa
Distribution: Fedora,Trustix,Debian
Posts: 290

Rep: Reputation: 30
nice script or you could just give them sudo rights to ifconfig
sometimes its about being lazy
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configuring the network Script satimis Linux From Scratch 8 05-18-2012 07:22 AM
Network Switching Script 65_289 Linux - Networking 0 07-06-2005 12:24 PM
Network Startup Script andy7t Linux - Wireless Networking 3 11-17-2004 07:16 AM
Need Help Writing a Network Script gauge73 Linux - Networking 1 12-15-2003 04:35 PM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:44 AM.

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