US Robotics USR2410 Manuel d'installation Page 59

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 67
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 58
6. 2. Network Profile Management 55
/usr/local/bin/eth0:
#!/bin/sh
prog=‘basename $0‘
test "X$SUPERCMD" = "X$prog" || exec /usr/bin/super $prog ${1+"$@"}
PATH="/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin"
ADDRESS=""
INTERFACE=eth0
#INTERFACE=wlan0
SCHEMEFILE=/var/state/network/scheme.$INTERFACE
touch $SCHEMEFILE
case "$1" in
load)
modprobe $INTERFACE
;;
unload)
modprobe −r $INTERFACE
;;
up|start)
echo "$INTERFACE: start"
ifup $INTERFACE 2> /dev/null
;;
down|stop)
echo "$INTERFACE: stop"
ifdown $INTERFACE 2> /dev/null
rmmod −a; rmmod −a
;;
restart)
echo "$INTERFACE: restart"
ifdown $INTERFACE 2> /dev/null
sleep 1
ifup $INTERFACE 2> /dev/null
;;
scheme)
if [ −z "$2" ]; then
cat $SCHEMEFILE | sed "s/−/ /" | awk ’{print $2}’
else
echo "$INTERFACE−$2" > $SCHEMEFILE
;;
*)
SCHEME=‘cat $SCHEMEFILE | sed "s/−/ /" | awk ’{print $2}’‘
SCHEMES=‘grep iface /etc/network/interfaces | grep $INTERFACE | sed "s/−/ /" | awk ’{printf "%s ", $3 }’‘
echo "Usage: $INTERFACE [up|start|down|stop|restart|scheme [xyz]]"
echo "where xyz is one of: $SCHEMES"
echo "Current scheme is: $SCHEME"
;;
esac
After the interface was brought up with the command wlan0 up, the script profile-select tries to match the as-
signed IP number against a list of possible IP numbers to select the appropriate network profile. This profile is
the installed by copying configuration files and by starting or stopping system services. After the interface was
brought down, the script profile-deselect reverts to a special default profile called offline,which does not map to
anetwork scheme.
/usr/local/packages/network/bin/profile-select:
#!/bin/sh
PROFILE_DIR="/etc/network/profiles"
PROFILE_STATE_FILE="/var/run/network/profile"
#Load current profile
PROFILE_CUR=‘cat $PROFILE_STATE_FILE | awk ’{print $3}’‘
PROFILE_NEW="offline"
#Select new profile
ADDRESS=‘ifconfig $IFACE | grep inet | sed "s/:/ /" | awk ’{print $3}’‘
for PROFILE in $(cd $PROFILE_DIR; ls −d [a−z0−9]* 2> /dev/null); do
PATTERNS="$PROFILE_DIR/$PROFILE/patterns"
Vue de la page 58
1 2 ... 54 55 56 57 58 59 60 61 62 63 64 65 66 67

Commentaires sur ces manuels

Pas de commentaire