Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Praktische Anwendungen (Showcase)
    4. Einen PI3 durch ioBroker herunterfahren?

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Einen PI3 durch ioBroker herunterfahren?

    This topic has been deleted. Only users with topic management privileges can see it.
    • paul53
      paul53 @Beowolf last edited by

      @Beowolf
      Ist das Modul 'node-ssh' in die Konfiguration der Javascript-Instanz eingetragen ?

      B 1 Reply Last reply Reply Quote 0
      • B
        Beowolf @paul53 last edited by Beowolf

        @paul53

        So sieht das bei mir aus

        nodessh.jpg

        Wenn ich das Skript unter iobroker "neustarte", kommt die Meldung im unteren LOG-Feld

        16:22:20.233	info	javascript.0 (24264) Stop script script.js.common.PI3_CopyShop_Neustart
        16:22:20.297	info	javascript.0 (24264) Start javascript script.js.common.PI3_CopyShop_Neustart
        16:22:20.305	error	javascript.0 (24264) script.js.common.PI3_CopyShop_Neustart: script.js.common.PI3_CopyShop_Neustart:2
        16:22:20.306	error	javascript.0 (24264) at script.js.common.PI3_CopyShop_Neustart:2:7
        

        Ich habe zwei Skripte. Einmal für einen Neustart und einmal zum Ausschalten.

        paul53 1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @Beowolf last edited by paul53

          @Beowolf
          Getestet

          const node_ssh = require('node-ssh');
          const ssh = new node_ssh();
          

          und erhalte den gleichen Fehler:

          javascript.1	2020-08-07 16:36:57.322	error	(5051) at script.js.common.Test:13:13
          javascript.1	2020-08-07 16:36:57.322	error	(5051) TypeError: node_ssh is not a constructor
          javascript.1	2020-08-07 16:36:57.322	error	(5051) ^
          javascript.1	2020-08-07 16:36:57.322	error	(5051) const ssh = new node_ssh();
          javascript.1	2020-08-07 16:36:57.321	error	(5051) script.js.common.Test: script.js.common.Test:13
          
          B 1 Reply Last reply Reply Quote 0
          • B
            Beowolf @paul53 last edited by

            @paul53

            Das ist schon mal gut. Ich dachte, das ich hier unsinn gemacht habe.

            Grüße
            Manfred

            coyote 1 Reply Last reply Reply Quote 0
            • coyote
              coyote Most Active @Beowolf last edited by coyote

              @Beowolf bekomme den gleiche Fehler, aber erst seit dem letzten Javascript Adapter Update.
              Im Script wird angezeigt, dass das Modul "node-ssh" nicht gefunden wird.

              B 1 Reply Last reply Reply Quote 0
              • B
                Beowolf @coyote last edited by

                @coyote

                Ist das den "rausgeflogen", oder nur ein Fehler?

                coyote Thomas Braun 2 Replies Last reply Reply Quote 0
                • coyote
                  coyote Most Active @Beowolf last edited by

                  @Beowolf gute Frage, weiß ich nicht. Mir ist es gestern nur aufgefallen, als ich meinen Po der am 3d Drucker hängt über iobroker runter fahren wollte. Ging bisher immer, vllt mal die Javascript Version downgraden, ob es dann funktioniert

                  paul53 1 Reply Last reply Reply Quote 0
                  • Thomas Braun
                    Thomas Braun Most Active @Beowolf last edited by Thomas Braun

                    @Beowolf @coyote

                    cd /opt/iobroker
                    npm list node-ssh
                    

                    Wenn das leer bleibt würde ich vermutlich node-ssh Mal nachinstallieren.

                    cd /opt/iobroker
                    npm install node-ssh
                    
                    coyote 1 Reply Last reply Reply Quote 0
                    • coyote
                      coyote Most Active @Thomas Braun last edited by

                      @Thomas-Braun da kommt node-ssh@11.0.0

                      Thomas Braun 1 Reply Last reply Reply Quote 0
                      • Thomas Braun
                        Thomas Braun Most Active @coyote last edited by

                        @coyote Genaue Rückmeldung?

                        paul53 1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @Thomas Braun last edited by

                          @Thomas-Braun:

                          Genaue Rückmeldung?

                          /opt/iobroker$ npm list node-ssh
                          iobroker.inst@2.0.3 /opt/iobroker
                          └─┬ iobroker.javascript@4.6.21
                            └── node-ssh@11.0.0 
                          
                          1 Reply Last reply Reply Quote 0
                          • paul53
                            paul53 @coyote last edited by

                            @coyote sagte:

                            Javascript Version downgraden, ob es dann funktioniert

                            Funktioniert auch mit Version 4.6.4 nicht. Muss wohl am Modul liegen.

                            paul53 1 Reply Last reply Reply Quote 0
                            • paul53
                              paul53 @paul53 last edited by paul53

                              Muss wohl am Modul liegen.

                              Der Zugriff wurde in Version 11.0.0 geändert:

                              const node_ssh = require('node-ssh').NodeSSH;
                              const ssh = new node_ssh();
                              

                              Die Doku unter npmjs.com ist noch nicht angepasst.

                              B 1 Reply Last reply Reply Quote 1
                              • B
                                Beowolf @paul53 last edited by

                                @paul53

                                Jepp, jetzt läuft wieder alles. Vielen Dank für die schnelle Hilfe.

                                Grüße
                                Manfred

                                1 Reply Last reply Reply Quote 0
                                • K
                                  Kusi @Asgothian last edited by

                                  @Asgothian sagte in Einen PI3 durch ioBroker herunterfahren?:

                                  Über ein Script geht das herunterfahren recht einfach:

                                  node_ssh = require('node-ssh');
                                  ssh = new node_ssh();
                                  ssh.connect({
                                    host: 'xxx.xxx.x.xxx',
                                    username: 'root',
                                    password: 'yourRootPasswordHere'
                                  }).then(() => {
                                    ssh.execCommand("YourShutdownCommandHere");
                                  })
                                  

                                  Mit einem anderen Command kann ich so den Plex-Dienst auf dem NAS stoppen/starten.
                                  Was mich jedoch stört ist die Tatsache, dass ich mich für SSH als Administrator anmelden muss
                                  und mein Passwort im Skript ersichtlich ist.

                                  Im Internet habe ich eine Seite gefunden, mit welchem man eine Key-Authentication erstellen kann.
                                  Leider weis ich dennoch nicht, wie dies vonstatten gehen soll.
                                  https://debian-administration.org/article/530/SSH_with_authentication_key_instead_of_password

                                  Kann mir jemand helfen?

                                  AlCalzone arteck Homoran mickym 4 Replies Last reply Reply Quote 0
                                  • AlCalzone
                                    AlCalzone Developer @Kusi last edited by

                                    @Kusi Hilft dir dieser Thread vielleicht?
                                    https://forum.iobroker.net/topic/12995/gelöst-blockly-per-ssh-an-anderen-rechner-und-script-ausführen

                                    1 Reply Last reply Reply Quote 0
                                    • arteck
                                      arteck Developer Most Active @Kusi last edited by

                                      @Kusi hilft dir das weiter
                                      https://checkmk.de/lw_ssh_anmeldung_ohne_passwort.html

                                      1 Reply Last reply Reply Quote 0
                                      • Homoran
                                        Homoran Global Moderator Administrators @Kusi last edited by

                                        @Kusi hast du dir mal den Adapter linux-control angesehen?

                                        1 Reply Last reply Reply Quote 0
                                        • mickym
                                          mickym Most Active @Kusi last edited by mickym

                                          @Kusi Es gibt duzende Anleitungen - aber ich habe es ein 2.Mal geschafft und fahre gerade einen anderen PI mit iobroker - zwar mit Node-Red runter - aber es ist egal. Das sollte dann grundsätzlich funktionieren

                                          Im Prinzip brauchst Du nur 2-3 Befehle und musst Dich als iobroker anmelden.

                                          Ich gehe mal davon aus, Du hast auf beiden Raspberries einen User PI.

                                          Mach mal Folgendes:

                                          1. Gib ein:
                                          sudo -su iobroker
                                          cd ~
                                          

                                          Dann solltest Du als Prompt das haben:

                                          iobroker@<deineMaschine>:~ $
                                          

                                          Wenn Du dann im iobroker HOME Verzeichnis

                                          ls -la .ssh 
                                          

                                          eingibst solltest Du eigentlich eine Fehlermeldung haben - da dieses Verzeichnis nicht exisistiert.

                                          Dann gibst ein:

                                          ssh-keygen -t rsa -b 4096 -C "iobroker@<DeineMaschine>"
                                          

                                          und bestätigst alles mit <Enter> ohne zusätzliches Passwort etc.

                                          Zum Schluß kopierst Du alles auf Deine Zielmaschine indem Du Dich mit dem pi auf Deiner Zielmaschine dann anmeldest - alles bestätigen.

                                          ssh-copy-id pi@<Zielmaschine>
                                          

                                          Kommandos auf zum Runterfahren ist genauso dann nur dass Du den Zielpfad noch mitgibst.

                                          Neustart der Zielmaschine sieht dann so aus:

                                          ssh pi@<Zielmaschine> sudo reboot
                                          

                                          Auf Deiner Zielmaschine hast Du dann unter dem HOME-Verzeichnis Deines pi Users auch ein Verzeichnis .ssh.

                                          Wenn Du reinschaust hast Du eine Datei namens authorized_keys. Da findest Du die öffentlichen Schlüssel und kannst bei Bedarf auch wieder einzelne löschen!

                                          K 1 Reply Last reply Reply Quote 0
                                          • K
                                            Kusi @mickym last edited by Kusi

                                            Vielen Dank für all eure Antworten.

                                            @Homoran Wo finde ich denn diesen Adapter und wofür soll dieser genau sein? Edit: Hab ihn angeschaut, sieht interessant aus... Danke für den Tipp!

                                            @mickym Danke für deine präzise Antwort. Ich nutze aber nicht 2 Raspberrys, sondern nur einer und ein Qnap NAS, auf welches ich einen Befehl schicken will.
                                            Gemäss Qnap funktioniert dort SSH nur als Administrator.

                                            @arteck Mit der Anleitung, welche du mir geschickt hast, kann ich wenigstens schon mal eine SSH-Verbindung ohne Passworteingabe herstellen, vielen Dank. Den SSH-Befehl senden per ioBroker geht aber leider nicht.
                                            Die Codezeile "Password" habe ich herausgelöscht und sieht nun wie folgt aus:

                                            const node_ssh = require('node-ssh').NodeSSH;
                                            const ssh = new node_ssh();
                                            ssh.connect({
                                              host: '192.168.1.10',
                                              username: 'admin'
                                            }).then(() => {
                                              ssh.execCommand("/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh start");
                                            })
                                            

                                            Folgende Fehler bekomme ich nun:

                                            An error happened which is most likely from one of your scripts, but the originating script could not be detected.

                                            Error: All configured authentication methods failed

                                            Error: All configured authentication methods failed at doNextAuth (/opt/iobroker/node_modules/iobroker.javascript/node_modules/ssh2/lib/client.js:413:17) at tryNextAuth (/opt/iobroker/n

                                            mickym 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            562
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            10
                                            87
                                            4852
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo