Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Exec Funktioniert nicht

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Exec Funktioniert nicht

    This topic has been deleted. Only users with topic management privileges can see it.
    • kmxak
      kmxak Most Active last edited by

      Moin, nutze zum ersten mal node red.

      Möchte gerne mit exec ein python script ausführen.

      als command habe ich

      sudo python /opt/test/iobroker.rfid/script/rfid.py
      

      pfad stimmt.

      Mache ich was falsch?

      Sollte unter Debug dann meine Ausgabe zu sehen sein?

      1 Reply Last reply Reply Quote 0
      • N
        nobody last edited by

        Hallo kmxak,

        prinzipiell funktioniert der Exec Node, wie rechts in der Node-Beschreibung beschrieben.

        Unter debug wird nur was ausgegeben, wenn du einen Debug-Node zufügst und den mit den Ausgängen verbindest.

        Der Node hat drei Ausgänge: stdout, stderr, und return code.

        Lass das sudo mal weg.

        Wenn du iobroker nach Anleitung installiert hast, wird nodered als root ausgeführt. sudo im exec Kommando bei einem Dienst sollte eigentlich nicht erlaubt sein, weil der Administrator dies nicht autorisieren kann. Dies wäre eine ziemliche Sicherheitslücke.

        Wenn das nichts hilft:

        Gib auch den Pfad zum Phytonkommando absolut an.

        Gesendet von meinem GT-N8000 mit Tapatalk

        1 Reply Last reply Reply Quote 0
        • kmxak
          kmxak Most Active last edited by

          Anbei ein Screenshot

          Der Node hat drei Ausgänge: stdout, stderr, und return code.

          :?:
          ` > Wenn das nichts hilft:

          Gib auch den Pfad zum Phytonkommando absolut an. `

          Auch hier verstehe ich nix.
          2343_py.png

          1 Reply Last reply Reply Quote 0
          • N
            nobody last edited by

            Wird denn bei der Ausführung irgendwas ausgegeben?

            Was mich wundert ist, dass bei deinem Flow überhaupt kein node da ist, der den Flow startet. Der Exec Node ist ein Mittelnode, der nicht von selbst startet. Füge mal einen inject node davor. Den kannst du durch den Schalter links von Hand triggern.

            Kannst du mal die vollständige Konfiguration des Exec Node hier rein schreiben. Der Exec - Node unterstützt exec und spawn zur Kommandoausführung. Wenn ich mich richtig erinnere darf bei spawn nur das Kommando (also python) unter command stehen. Der gesamte Rest ist eigentlich ein Parameter, der unter append stehen muss. Exec unterstützt glaube ich beides. Die Checkbox vor msg.payload darf nicht gesetzt sein. Sonst fügt er die eingehende msg.payload als Parameter an.

            Speziell für Python gibt es noch einen Kommentar:

            If running a Python app you may need to use the -u parameter to stop the output being buffered

            Gesendet von meinem GT-N8000 mit Tapatalk

            1 Reply Last reply Reply Quote 0
            • kmxak
              kmxak Most Active last edited by

              ! ````
              [
              {
              "id": "7419bfb6.fe762",
              "type": "exec",
              "z": "e608e40d.eacc3",
              "command": "python /opt/test/iobroker.rfid/script/rfid.py",
              "addpay": false,
              "append": "",
              "useSpawn": false,
              "timer": "",
              "name": "python /opt/test/iobroker.rfid/script/rfid.py",
              "x": 440,
              "y": 200,
              "wires": [
              [
              "6a522737.9a8b58"
              ],
              [
              "4aeaa22d.0f8e24"
              ],
              [
              "c1e524b1.858bf"
              ]
              ]
              },
              {
              "id": "6a522737.9a8b58",
              "type": "debug",
              "z": "e608e40d.eacc3",
              "name": "",
              "active": true,
              "console": "true",
              "complete": "true",
              "x": 750,
              "y": 143,
              "wires": []
              },
              {
              "id": "c1e524b1.858bf",
              "type": "debug",
              "z": "e608e40d.eacc3",
              "name": "",
              "active": true,
              "console": "true",
              "complete": "true",
              "x": 820,
              "y": 240,
              "wires": []
              },
              {
              "id": "4aeaa22d.0f8e24",
              "type": "debug",
              "z": "e608e40d.eacc3",
              "name": "",
              "active": true,
              "console": "true",
              "complete": "true",
              "x": 890,
              "y": 180,
              "wires": []
              },
              {
              "id": "57b8f669.2b64f",
              "type": "inject",
              "z": "e608e40d.eacc3",
              "name": "",
              "topic": "",
              "payload": "true",
              "payloadType": "bool",
              "repeat": "",
              "crontab": "",
              "once": true,
              "x": 130,
              "y": 220,
              "wires": [
              [
              "7419bfb6.fe762"
              ]
              ]
              }
              ]

              
              Hier der Code im Debug steht rein gar nix.
              
              Habe nun mal den Debug auf dem Injekt gesetzt und geschaut ob da was kommt und das tut es. also läuft das exec nicht wie vermutet
              
              EDIT: So geht es und es kommt eine Ausgabe! Ob es alles richtig ist weiß ich allerdings noch nicht :mrgreen:
              
              >! ````
              [
                  {
                      "id": "7419bfb6.fe762",
                      "type": "exec",
                      "z": "e608e40d.eacc3",
                      "command": "python",
                      "addpay": false,
                      "append": "/opt/test/iobroker.rfid/script/rfid.py",
                      "useSpawn": true,
                      "timer": "",
                      "name": "python /opt/test/iobroker.rfid/script/rfid.py",
                      "x": 440,
                      "y": 200,
                      "wires": [
                          [
                              "44e6c2bc.2f9934"
                          ],
                          [
                              "cf0e0d61.e0f6b"
                          ],
                          [
                              "a81ff54e.6a04f8"
                          ]
                      ]
                  },
                  {
                      "id": "57b8f669.2b64f",
                      "type": "inject",
                      "z": "e608e40d.eacc3",
                      "name": "",
                      "topic": "",
                      "payload": "true",
                      "payloadType": "bool",
                      "repeat": "",
                      "crontab": "",
                      "once": true,
                      "x": 130,
                      "y": 220,
                      "wires": [
                          [
                              "7419bfb6.fe762"
                          ]
                      ]
                  },
                  {
                      "id": "44e6c2bc.2f9934",
                      "type": "debug",
                      "z": "e608e40d.eacc3",
                      "name": "",
                      "active": true,
                      "console": "true",
                      "complete": "true",
                      "x": 800,
                      "y": 160,
                      "wires": []
                  },
                  {
                      "id": "cf0e0d61.e0f6b",
                      "type": "debug",
                      "z": "e608e40d.eacc3",
                      "name": "",
                      "active": true,
                      "console": "true",
                      "complete": "true",
                      "x": 900,
                      "y": 200,
                      "wires": []
                  },
                  {
                      "id": "a81ff54e.6a04f8",
                      "type": "debug",
                      "z": "e608e40d.eacc3",
                      "name": "",
                      "active": true,
                      "console": "true",
                      "complete": "true",
                      "x": 880,
                      "y": 340,
                      "wires": []
                  }
              ]
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              483
              Online

              31.7k
              Users

              79.8k
              Topics

              1.3m
              Posts

              2
              5
              2793
              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