From: Laurent Mazet Date: Fri, 9 Oct 2015 17:55:03 +0000 (+0200) Subject: finish renaming script names X-Git-Tag: debian_7.8.8~7 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=90b53a74e6ab72a304e99b8b7dd12c2e3bd29edd;p=debian6500.git finish renaming script names --- diff --git a/master/etc/webconfig/alias.d/50-trc6500-master-file.csv b/master/etc/webconfig/alias.d/50-trc6500-master-file.csv index d393d42..dc65735 100644 --- a/master/etc/webconfig/alias.d/50-trc6500-master-file.csv +++ b/master/etc/webconfig/alias.d/50-trc6500-master-file.csv @@ -46,15 +46,23 @@ ipmi;/usr/share/webconfig;;Configure IPMI for all Supermicro blades;sudo /opt/sc /dce;/usr/share/dce;/etc/dhcp/dhcpd.conf;DHCPD Configuration Editor;sudo service isc-dhcp-server restart ntp;/usr/share/webconfig;;Synchronize time and date on all blades;sudo /opt/script/check_network -c 'service chrony stop; ntpdate-debian; service chrony start' -o ;;;Internal equipements; -http://10.133.26.160:8110;/usr/share/webconfig;;FE306-1;:goto: -http://10.133.26.160:8120;/usr/share/webconfig;;FE306-2;:goto: -http://10.133.26.160:8130;/usr/share/webconfig;;FE306-3;:goto: -http://10.133.26.160:8140;/usr/share/webconfig;;FE306-4;:goto: -http://10.133.26.160:8150;/usr/share/webconfig;;FE306-5;:goto: -http://10.133.26.231;/usr/share/webconfig;;Switch Monitoring;:goto: -http://10.133.26.160:8231;/usr/share/webconfig;;Switch Gonio 1;:goto: -http://10.133.26.160:8232;/usr/share/webconfig;;Switch Gonio 2;:goto: -http://10.133.26.254;/usr/share/webconfig;;GPS;:goto: +http://10.133.28.160:8110;/usr/share/webconfig;;FE306-1;:goto: +http://10.133.26.160:8110;/usr/share/webconfig;;FE306-1 (lite);:goto: +http://10.133.28.160:8120;/usr/share/webconfig;;FE306-2;:goto: +http://10.133.26.160:8120;/usr/share/webconfig;;FE306-2 (lite);:goto: +http://10.133.28.160:8130;/usr/share/webconfig;;FE306-3;:goto: +http://10.133.26.160:8130;/usr/share/webconfig;;FE306-3 (lite);:goto: +http://10.133.28.160:8140;/usr/share/webconfig;;FE306-4;:goto: +http://10.133.26.160:8140;/usr/share/webconfig;;FE306-4 (lite);:goto: +http://10.133.28.160:8150;/usr/share/webconfig;;FE306-5;:goto: +http://10.133.26.160:8150;/usr/share/webconfig;;FE306-5 (lite);:goto: +http://10.133.28.231;/usr/share/webconfig;;Switch Monitoring;:goto: +http://10.133.28.160:8231;/usr/share/webconfig;;Switch Gonio 1;:goto: +http://10.133.26.160:8231;/usr/share/webconfig;;Switch 1 (lite);:goto: +http://10.133.28.160:8232;/usr/share/webconfig;;Switch Gonio 2;:goto: +http://10.133.26.160:8232;/usr/share/webconfig;;Switch 2 (lite);:goto: +http://10.133.28.254;/usr/share/webconfig;;GPS;:goto: +http://10.133.26.254;/usr/share/webconfig;;GPS (lite);:goto: ;;;TRC6500 MIB; /swb;/usr/share/swb;/var/cache/webconfig/snmp.tree;SNMP Web Browser;/opt/trc6500/bin/snmp-trc6500-walk|sed 's/enterprises\.thales\.//'>/var/cache/webconfig/snmp.tree ;;;Chassis actions; @@ -69,7 +77,7 @@ mediatray;/usr/share/webconfig;;Remove media-tray on HS22 chassis;/opt/script/se 12mhzdf;/usr/share/webconfig;;Setup 12MHzDF mode;sudo /opt/script/change_configuration 12MHzDF 12mhzmdf;/usr/share/webconfig;;Setup 12MHzMDF mode;sudo /opt/script/change_configuration 12MHzMDF 30mhzmdf;/usr/share/webconfig;;Setup 30MHzMDF mode;sudo /opt/script/change_configuration 30MHzMDF -30mhzmdf.lite;/usr/share/webconfig;;Setup 30MHzMDF lite mode;sudo /opt/script/change_configuration 30MHzMDF.lite +30mhzmdf.lite.lite;/usr/share/webconfig;;Setup 30MHzMDF lite mode;sudo /opt/script/change_configuration 30MHzMDF.lite 30mhzmhf;/usr/share/webconfig;;Setup 30MHzMHF mode;sudo /opt/script/change_configuration 30MHzMHF hw_ibm;/usr/share/webconfig;;Setup IBM HS22 chassis mode;sudo /opt/script/change_configuration hw_ibm hw_supermicro;/usr/share/webconfig;;Setup FatTwin Supermicro chassis mode;sudo /opt/script/change_configuration hw_supermicro @@ -77,5 +85,5 @@ tz_zulu;/usr/share/webconfig;;Setup Zulu timezone;sudo /opt/script/change_config tz_paris;/usr/share/webconfig;;Setup Europe/Paris timezone;sudo /opt/script/change_configuration tz_paris tarballs;/usr/share/webconfig;;Build tarballs;sudo make -f /opt/cluster/Makefile all ;;;Install LgCore actions; -install-usb;/usr/share/webconfig;;Install LgCore from USB key;sudo /root/bin/change_lgcore.sh usb -install-file;/usr/share/webconfig;;Install LgCore from local file;sudo /root/bin/change_lgcore.sh file -r /var/cache/webconfig +install-usb;/usr/share/webconfig;;Install LgCore from USB key;sudo /opt/script/change_lgcore usb +install-file;/usr/share/webconfig;;Install LgCore from local file;sudo /opt/script/change_lgcore file -r /var/cache/webconfig diff --git a/master/opt/script/change_lgcore b/master/opt/script/change_lgcore new file mode 100755 index 0000000..24c2da8 --- /dev/null +++ b/master/opt/script/change_lgcore @@ -0,0 +1,90 @@ +#!/bin/bash +# ============================================================================ +# +# Copyright (C) THALES. All rights reserved +# Author: Laurent Mazet +# +# Date : 17/12/2014 +# ============================================================================ + +# Install new lgcore delivery + +# TODO +# * + +MODE= +PROGNAME=$(basename $0) +REPOSITORY="/opt/trc6500/debian-rep" +TMPLOG=/tmp/$PROGNAME-$$.log +VER=1.0 + +# help function + +function usage () { + echo "usage: $PROGNAME [-h] [-r dir] [-v] " + echo " install new version from lgcore delivery from" + echo " - usb: usb key slotted on master blade" + echo " - file: file stored in a special repository" + echo + echo " options are:" + echo " -h: help message" + echo " -r: change repository (default is $REPOSITORY)" + echo " -v: version" + exit $@ +} + +# formating functions + +function title () { echo -e "\033[0;1m$*\033[0;0m"; } +function pass () { echo -e "\033[1;32m$*\033[0;0m"; } +function warn () { echo -e "\033[1;33m$*\033[0;0m"; } +function fail () { echo -e "\033[1;31m$*\033[0;0m"; } + +# check command + +function check () { + echo -n "$@: " + $@ 2>$TMPLOG && pass OK || { fail KO; cat $TMPLOG; exit 1; } + rm -f $TMPLOG +} + +# argument processing + +while [ $# -gt 0 ]; do + case "$1" in + -h) usage 0;; + -r) shift; REPOSITORY=$1;; + -v) echo "$PROGNAME version $VER"; exit 0;; + file|usb) MODE=$1;; + *) usage 1;; + esac + shift +done + +# check mode + +[ "$MODE" ] || { fail "need mode (file or usb)"; exit 1; } + +# check repository + +DIR= +case "$MODE" in +file) DIR=$REPOSITORY;; +usb) + DIR=/media/floppy0 + check mount /dev/sdb1 $DIR + trap "umount $DIR;" 0 1 2 15 +esac + +# look for file + +echo -n "look for delivery file: " +LIV=$(find $DIR -name liv\*.sfx 2>$TMPLOG | sort | tail -1) +[ -f "$LIV" ] && pass OK || { fail KO; cat $TMPLOG; exit 1; } +rm -f $TMPLOG + +# install lgcore delivery + +check bash $LIV + +# vim:set tabstop=4 expandtab shiftwidth=4: diff --git a/master/opt/script/cpuclock b/master/opt/script/cpuclock new file mode 100644 index 0000000..21d7e2a --- /dev/null +++ b/master/opt/script/cpuclock @@ -0,0 +1,16 @@ +#!/usr/bin/awk -f + +BEGIN { + ARGV[1]="/proc/cpuinfo" + ARGC=2 +} + +/MHz/ { + cpu[$4]++ +} + +END { + for (i in cpu) + printf " %s x %d", i, cpu[i] + printf "\n" +} diff --git a/master/root/bin/change_lgcore.sh b/master/root/bin/change_lgcore.sh deleted file mode 100755 index 24c2da8..0000000 --- a/master/root/bin/change_lgcore.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# ============================================================================ -# -# Copyright (C) THALES. All rights reserved -# Author: Laurent Mazet -# -# Date : 17/12/2014 -# ============================================================================ - -# Install new lgcore delivery - -# TODO -# * - -MODE= -PROGNAME=$(basename $0) -REPOSITORY="/opt/trc6500/debian-rep" -TMPLOG=/tmp/$PROGNAME-$$.log -VER=1.0 - -# help function - -function usage () { - echo "usage: $PROGNAME [-h] [-r dir] [-v] " - echo " install new version from lgcore delivery from" - echo " - usb: usb key slotted on master blade" - echo " - file: file stored in a special repository" - echo - echo " options are:" - echo " -h: help message" - echo " -r: change repository (default is $REPOSITORY)" - echo " -v: version" - exit $@ -} - -# formating functions - -function title () { echo -e "\033[0;1m$*\033[0;0m"; } -function pass () { echo -e "\033[1;32m$*\033[0;0m"; } -function warn () { echo -e "\033[1;33m$*\033[0;0m"; } -function fail () { echo -e "\033[1;31m$*\033[0;0m"; } - -# check command - -function check () { - echo -n "$@: " - $@ 2>$TMPLOG && pass OK || { fail KO; cat $TMPLOG; exit 1; } - rm -f $TMPLOG -} - -# argument processing - -while [ $# -gt 0 ]; do - case "$1" in - -h) usage 0;; - -r) shift; REPOSITORY=$1;; - -v) echo "$PROGNAME version $VER"; exit 0;; - file|usb) MODE=$1;; - *) usage 1;; - esac - shift -done - -# check mode - -[ "$MODE" ] || { fail "need mode (file or usb)"; exit 1; } - -# check repository - -DIR= -case "$MODE" in -file) DIR=$REPOSITORY;; -usb) - DIR=/media/floppy0 - check mount /dev/sdb1 $DIR - trap "umount $DIR;" 0 1 2 15 -esac - -# look for file - -echo -n "look for delivery file: " -LIV=$(find $DIR -name liv\*.sfx 2>$TMPLOG | sort | tail -1) -[ -f "$LIV" ] && pass OK || { fail KO; cat $TMPLOG; exit 1; } -rm -f $TMPLOG - -# install lgcore delivery - -check bash $LIV - -# vim:set tabstop=4 expandtab shiftwidth=4: diff --git a/master/root/bin/conf_switch_integration b/master/root/bin/conf_switch_integration new file mode 100755 index 0000000..b454138 --- /dev/null +++ b/master/root/bin/conf_switch_integration @@ -0,0 +1,40 @@ +#!/usr/bin/expect + +set sub [lrange $argv 0 0] +if { $sub == "" } { set sub "1" } +spawn telnet sw1 + +expect { + "Password:" { send "thales\r" } + incorrect { send_user "invalid password or account\n"; exit } + timeout { send_user "connection to $sub timed out\n"; exit } + eof { send_user "connection to host failed\n"; exit } +} +expect -exact ">" { send "enable\r" } +expect "Password:" { send "thales\r" } + +expect -exact "#" { send "config terminal\r" } + +expect -exact "#" { send "vlan 192\r" } +expect -exact "#" { send "name Integration\r" } +expect -exact "#" { send "exit\r" } +f +expect -exact "#" { send "interface gigabitEthernet 1/47\r" } +expect -exact "#" { send "switchport mode access\r" } +expect -exact "#" { send "switchport access vlan 192\r" } +expect -exact "#" { send "exit\r" } + +expect -exact "#" { send "interface vlan 192\r" } +expect -exact "#" { send "ip address 192.168.$sub.231 255.255.255.0\r" } +expect -exact "#" { send "ip pim dense-mode\r" } +expect -exact "#" { send "no shutdown\r" } +expect -exact "#" { send "exit\r" } + +expect -exact "#" { send "ip route 192.168.$sub.0 255.255.255.0 Vlan192\r" } +expect -exact "#" { send "ip route 192.168.$sub.160 255.255.255.255 10.133.26.160\r" } +expect -exact "#" { send "ip route 192.168.$sub.101 255.255.255.255 Vlan10\r" } +expect -exact "#" { send "ip route 192.168.0.0 255.255.255.0 192.168.$sub.230\r" } +expect -exact "#" { send "exit\r" } + +expect -exact "#" { send "exit\r" } + diff --git a/master/root/bin/conf_switch_integration.tcl b/master/root/bin/conf_switch_integration.tcl deleted file mode 100755 index b454138..0000000 --- a/master/root/bin/conf_switch_integration.tcl +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/expect - -set sub [lrange $argv 0 0] -if { $sub == "" } { set sub "1" } -spawn telnet sw1 - -expect { - "Password:" { send "thales\r" } - incorrect { send_user "invalid password or account\n"; exit } - timeout { send_user "connection to $sub timed out\n"; exit } - eof { send_user "connection to host failed\n"; exit } -} -expect -exact ">" { send "enable\r" } -expect "Password:" { send "thales\r" } - -expect -exact "#" { send "config terminal\r" } - -expect -exact "#" { send "vlan 192\r" } -expect -exact "#" { send "name Integration\r" } -expect -exact "#" { send "exit\r" } -f -expect -exact "#" { send "interface gigabitEthernet 1/47\r" } -expect -exact "#" { send "switchport mode access\r" } -expect -exact "#" { send "switchport access vlan 192\r" } -expect -exact "#" { send "exit\r" } - -expect -exact "#" { send "interface vlan 192\r" } -expect -exact "#" { send "ip address 192.168.$sub.231 255.255.255.0\r" } -expect -exact "#" { send "ip pim dense-mode\r" } -expect -exact "#" { send "no shutdown\r" } -expect -exact "#" { send "exit\r" } - -expect -exact "#" { send "ip route 192.168.$sub.0 255.255.255.0 Vlan192\r" } -expect -exact "#" { send "ip route 192.168.$sub.160 255.255.255.255 10.133.26.160\r" } -expect -exact "#" { send "ip route 192.168.$sub.101 255.255.255.255 Vlan10\r" } -expect -exact "#" { send "ip route 192.168.0.0 255.255.255.0 192.168.$sub.230\r" } -expect -exact "#" { send "exit\r" } - -expect -exact "#" { send "exit\r" } - diff --git a/master/root/bin/cpumon_light b/master/root/bin/cpumon_light deleted file mode 100755 index af635c1..0000000 --- a/master/root/bin/cpumon_light +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl - -use strict; - -my @cpu_stat_t0 = proc_stat(); -sleep 1; -my @cpu_stat_t1 = proc_stat(); -my $total = 0; -for (my $cpu_i = 0; $cpu_i < (scalar @cpu_stat_t0); $cpu_i++) { - my @stat_t0 = split /\s+/, $cpu_stat_t0[$cpu_i]; - my @stat_t1 = split /\s+/, $cpu_stat_t1[$cpu_i]; - my ($t0_idle, $t1_idle) = ($stat_t0[3], $stat_t1[3]); - my ($t0_total, $t1_total) = (0, 0); - $t0_total += $_ foreach @stat_t0; - $t1_total += $_ foreach @stat_t1; - - my $load = ($t1_total - $t0_total == 0) ? 100: - int((100 * (($t1_total - $t0_total) - ($t1_idle - $t0_idle))/($t1_total - $t0_total)) + 0.5); - print " +" unless ($cpu_i == 0); - printf "% 5.1f%% ", $load; - $total += $load; -} -printf " = % 6.1f%%\n", $total; - -sub proc_stat() { - return grep {s/^cpu\d+\s//} read_file('/proc/stat'); -} - -sub read_file($) { - my ($file) = @_; - open FILE, "<$file"; - my @content = ; - close FILE; - return @content; -} - diff --git a/master/root/bin/deploiement_conf_reseau_integration b/master/root/bin/deploiement_conf_reseau_integration new file mode 100755 index 0000000..fffec88 --- /dev/null +++ b/master/root/bin/deploiement_conf_reseau_integration @@ -0,0 +1,59 @@ +#!/bin/bash + +################################### +# deploie le reseau d'integration sur le capteur +################################### +# Numero du sous reseau 192.168.x.160 +# 1 : Sous reseau pour Alpha +# 2 : Sous reseau pour Clovis + +# globals vars +APTSOURCES=/etc/apt/sources.list.d/reseau_integration.list +SWITCH=0 +PROGNAME=$(basename $0) +VER=1.1 + +# help function +function usage () { + echo "usage: $PROGNAME -r" + echo " -h : affiche cette aide" + echo " -r : numero du sous reseau (1 pour alpha, 2 pour cl0, 3 pour gamma) (obligatoire)" + echo " -s : execute egalement le script de deploiement sur le switch" + echo " Deploiement du reseau d'integration sur le capteur" + exit $@ +} + +# argument processing +while [ $# -gt 0 ]; do + case "$1" in + -h) usage 0;; + -r) shift; SUB="$1";; + -s) shift; SWITCH=1;; + *) usage 1;; + esac + shift +done + +# main processing + +[ "$SUB" != "" ] || usage 1 + + +# Attribution adresse IP au capteur dans le domaine 192.168.$SUB.0 +ip addr add 192.168.$SUB.160/24 dev eth0 + +# Definition des routes supplementaires +ip route add 192.168.$SUB.160 via 192.168.$SUB.231 dev eth0 +ip route add 192.168.$SUB.231 via 192.168.$SUB.160 dev eth0 +ip route add 192.168.0.53 via 192.168.$SUB.160 dev eth0 + +if [ $SWITCH -eq 1 ]; then + # Recuperation du chemin pour executer le script du switch depuis un chemin quelconque + mydir=$(dirname $0) + [ "$mydir" ] || mydir=. + [[ "$mydir" =~ ^/ ]] || mydir=$(cd $mydir; pwd) + $mydir/conf_switch_integration $SUB +fi + +# Ajout des depots debian +[ -f $APTSOURCES~ ] && mv -f $APTSOURCES~ $APTSOURCES diff --git a/master/root/bin/deploiement_conf_reseau_integration.sh b/master/root/bin/deploiement_conf_reseau_integration.sh deleted file mode 100755 index c0bcfd1..0000000 --- a/master/root/bin/deploiement_conf_reseau_integration.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -################################### -# deploie le reseau d'integration sur le capteur -################################### -# Numero du sous reseau 192.168.x.160 -# 1 : Sous reseau pour Alpha -# 2 : Sous reseau pour Clovis - -# globals vars -APTSOURCES=/etc/apt/sources.list.d/reseau_integration.list -SWITCH=0 -PROGNAME=$(basename $0) -VER=1.1 - -# help function -function usage () { - echo "usage: $PROGNAME -r" - echo " -h : affiche cette aide" - echo " -r : numero du sous reseau (1 pour alpha, 2 pour cl0, 3 pour gamma) (obligatoire)" - echo " -s : execute egalement le script de deploiement sur le switch" - echo " Deploiement du reseau d'integration sur le capteur" - exit $@ -} - -# argument processing -while [ $# -gt 0 ]; do - case "$1" in - -h) usage 0;; - -r) shift; SUB="$1";; - -s) shift; SWITCH=1;; - *) usage 1;; - esac - shift -done - -# main processing - -[ "$SUB" != "" ] || usage 1 - - -# Attribution adresse IP au capteur dans le domaine 192.168.$SUB.0 -ip addr add 192.168.$SUB.160/24 dev eth0 - -# Definition des routes supplementaires -ip route add 192.168.$SUB.160 via 192.168.$SUB.231 dev eth0 -ip route add 192.168.$SUB.231 via 192.168.$SUB.160 dev eth0 -ip route add 192.168.0.53 via 192.168.$SUB.160 dev eth0 - -if [ $SWITCH -eq 1 ]; then - # Recuperation du chemin pour executer le script du switch depuis un chemin quelconque - mydir=$(dirname $0) - [ "$mydir" ] || mydir=. - [[ "$mydir" =~ ^/ ]] || mydir=$(cd $mydir; pwd) - $mydir/conf_switch_integration.tcl $SUB -fi - -# Ajout des depots debian -[ -f $APTSOURCES~ ] && mv -f $APTSOURCES~ $APTSOURCES