×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Schwanzersatzfaktor-Berechnung

    Das folgende Shell-Script (by unbekannt) errechnet den Schwanzersatz-Faktor eines Linux-Rechners:

    #!/bin/sh
    LC_ALL=C
    echo `uptime|grep days|sed 's/.*up \([0-9]*\) day.*/\1\/10+/'; \
    cat /proc/cpuinfo|grep MHz|awk '{print $4"/30 +";}'; free|grep '^Mem' \
    |awk '{print $3"/1024/3+"}'; df -P -k -x nfs | grep -v 1k \
    | awk '{if ($1 ~ "/dev/(scsi|sd)"){ s+= $2} s+= $2;} END \
    {print s/1024/50"/15+70";}'`|bc|sed 's/\(.$\)/.\1cm/'
    
    

    found on Geekpeitsche / [1]



    Nachdem ich also alle benötigten Programme instaliert hatte (bc fehlte mir zunächst) erhielt ich folgende Meldung:

    $ ./schwanzersatzfaktor.sh
    (standard_in) 1: parse error
    

    :-(

    Kurze Nachfroschung ergab, das awk komischerweise "," statt "." verwendet um Zahlen mit Nachkommastellen anzuzeigen. Das mag aber bc wohl nicht. Also habe ich das Script wie folgt modifiziert:

    #!/bin/sh
    LC_ALL=C
    echo `uptime|grep days|sed 's/.*up \([0-9]*\) day.*/\1\/10+/'; \
    cat /proc/cpuinfo|grep MHz|awk '{print $4"/30 +";}'; free|grep '^Mem' \
    |awk '{print $3"/1024/3+"}'; df -P -k -x nfs | grep -v 1k \
    | awk '{if ($1 ~ "/dev/(scsi|sd)"){ s+= $2} s+= $2;} END \
    {print s/1024/50"/15+70";}'`|sed s/,/./g|bc|sed 's/\(.$\)/.\1cm/'
    

    ...und komme nu auf Stolze

    $ ./schwanzersatzfaktor.sh
    34.8cm
    

    :)



    geist: ./schwanz.sh
    18.6cm
    


    jupiter: ./sef.sh
    52.8cm
    


    Was sagt dein Computer? Poste deinen Faktor hier! :-)


    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.