[Gelöst] betr. Script Himbeere

  • Ersteller Ersteller SF1975
  • Erstellt am Erstellt am
S

SF1975

Guest
Hallo,
Das Script "psgHimbeere.php" zeigt neben einigen Details ja auch den verbrauchten Speicherplatz an (disk).
Kann man das Optional für den angeschlossenen USB-Stick (sda) machen? Es sitzt irgendwo hier?
PHP:
        $befehl='sudo df | grep "rootfs"';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statusdisk=web($url,$post);
        $Statusdisk=substr($Statusdisk,strpos($Statusdisk,"%")-3,3);

[EDIT]
Nach einiger Spielerei habe ich es so gelöst:
Anhang anzeigen 81670
PHP:
<?php

    /*
        +---------------------------------------------------------------------+
        |                                                                     |
        |   SensorAndSwitch                                      PSG-Script   |
        |   ===============================================================   |
        |   Status RaspberryPI                               sashelper (PI)   |
        |                                                        Web (curl)   |
        |   (C)2014/15 BlueDragon                                             !
        |                                                                     |
        +---------------------------------------------------------------------+
    */

    include __DIR__."/../include/psg.php";

    $ver="4.25";
    $ver="V#V ".$ver."#V#PI 2*AIN#";
    $befehl='sudo /usr/bin/vcgencmd measure_temp';
    $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
    $Statustemp=web($url,$post);
    if ($Statustemp) {
        $befehl='sudo /usr/bin/vcgencmd measure_clock arm';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statustakt=web($url,$post);
        $befehl='sudo /usr/bin/vcgencmd measure_volts core';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statusvolt=web($url,$post);
        $befehl='sudo /usr/bin/vcgencmd measure_clock core';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statustaktc=web($url,$post);
        $befehl='sudo free | grep "Mem"';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statusram=web($url,$post);
        $Statusram=explode(" ",preg_replace("/\s+/", " ", $Statusram));
        $Statusram=$Statusram[2]/$Statusram[1]*100;
        $befehl='sudo df | grep "rootfs"';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statusdisk=web($url,$post);
        $Statusdisk=substr($Statusdisk,strpos($Statusdisk,"%")-3,3);

        $befehl='sudo df | grep "/dev/sda"';
        $url=$helperurlpi."?befehl=".encodiere($befehl,33455);
        $Statusdisk2=web($url,$post);
        $Statusdisk2=substr($Statusdisk2,strpos($Statusdisk2,"%")-3,3);




        if ($Statustakt) {
            echo 'P#<div style="position:absolute;top:-6px;font-size:13px;text-align:left;">CPU: '.number_format(sprintf('%.0f',(substr($Statustakt,strpos($Statustakt,"=")+1)*1/1000000)),0,",",".").' MHz<br />Temp: '.number_format((substr($Statustemp,5)*1),1,",",".").'°C<br />RAM used:'.number_format($Statusram,0,",",".").'%%</div><div style="position:absolute;top:-6px;font-size:13px;left:105px;text-align:left;">Disk used: '.$Statusdisk.'%%<br />Stick used: '.$Statusdisk2.'%%</div><div  style="position:absolute;top:-20px;font-size:14px;width:322px;"><span id="klick"><a href="'.$Conf["PSG"].'doitshutdown.php"><img src="'.picdesign("schalter3.png").'"></a></span></div><div style="position:absolute;top:-20px;font-size:14px;width:277px"><span id="klick"><a href="'.$Conf["PSG"].'doitreboot.php"><img src="'.picdesign("schalterr.png").'"></a></span></div>*HTML#'.$ver;
        }
    }
    exit;
    
?>
 
Zuletzt bearbeitet von einem Moderator:
$befehl='sudo df | grep "/dev/sda1"';

Bin zu spät...
 
Hallo,
anstelle von sda1 habe ich nur sda genommen. Scheint auch zu klappen.
 
Ja, das spielt in dem Fall keine Rolle. Wenn auf dem Stick mehrere Partitionen wären, dann schon. ;)
 
Hallo,
Im Moment plane ich, einen 2. Stick an den PI zu packen. Mal schauen, wie ich das dann löse. Aber erst einmal muss der Stick her :mrgreen:
 
Die heißen dann /dev/sda..., /dev/sdb..., /dev/sdc... usw.

und auf einem Stick dann die Partitionen /dev/sda1, /dev/sda2, usw.
/dev/sdb1, /dev/sdb2, usw.
 
Kostenlos!

Statistik des Forums

Themen
248,987
Beiträge
2,307,960
Mitglieder
378,769
Neuestes Mitglied
JSt Aero