FHEM Forum

FHEM => Automatisierung => DOIF => Thema gestartet von: blasterx am 15 September 2017, 19:43:44

Titel: Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 15 September 2017, 19:43:44
Hallo,
folgendesProblem habe ich mit einem DOIF-Code. Wenn ich das DOIF

([DU_Test]) {system ('find tor/test/*.jpg -mtime +1 -exec rm {} \;;')}

ausführe bekomme ich folgende Fehlermeldung
{system ('find tor/test/*.jpg -mtime +1 -exec rm \;;')}: -1
und im Log steht
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
2017.09.15 19:41:22 2: di_test5: {system ('find tor/test/*.jpg -mtime +1 -exec rm  \;;')}: -1

Aber in einem Notify geht der Code wunderbar und die Bilder werden gelöscht.
DU_Test:.* {system ('find tor/test/*.jpg -mtime +1 -exec rm {} \;;')}
Vieleicht kann mir Jemand helfen wo der Fehler liegt?

Gruß BlasterX
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Ma_Bo am 15 September 2017, 19:49:00
Zitat von: blasterx am 15 September 2017, 19:43:44
Hallo,
folgendesProblem habe ich mit einem DOIF-Code. Wenn ich das DOIF

([DU_Test]) {system ('find tor/test/*.jpg -mtime +1 -exec rm {} \;;')}

ausführe bekomme ich folgende Fehlermeldung
{system ('find tor/test/*.jpg -mtime +1 -exec rm \;;')}: -1
und im Log steht
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
rm: missing operand
Try `rm --help' for more information.
2017.09.15 19:41:22 2: di_test5: {system ('find tor/test/*.jpg -mtime +1 -exec rm  \;;')}: -1

Aber in einem Notify geht der Code wunderbar und die Bilder werden gelöscht.
DU_Test:.* {system ('find tor/test/*.jpg -mtime +1 -exec rm {} \;;')}
Vieleicht kann mir Jemand helfen wo der Fehler liegt?

Gruß BlasterX

Versuchs mal so:

   
([DU_Test]) ({system ('find tor/test/*.jpg -mtime +1 -exec rm {} \;;')})

Gruß Marcel


Tapatalk iPhone, daher kurz gehalten.
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 15 September 2017, 19:57:05
@Ma_Bo
Das mit den Klammern () habe ich schon getestet da kommt der gleiche Fehler. DOIF akzeptiert perl Befehle in geschweiften Klammern. Das habe ich gestern von amenomade erfahren.
ZitatSeit Monaten akzeptiert DOIF perl Befehle in geschweifte Klammern.
Genau seit Revision 13635 vom 07.03.2017 "Doc fixed, Perl code without semicolon duplication and without () -brackets possible"

Gruß BlasterX
Titel: Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Ma_Bo am 15 September 2017, 19:59:59
Vielleicht so:    
([DU_Test]) ({find tor/test/*.jpg -mtime +1 -exec rm {} \;;})


Tapatalk iPhone, daher kurz gehalten.
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 15 September 2017, 20:09:57
Das Habe ich auch schon probiert mit folgender Fehlermeldung
{find tor/test/*.jpg -mtime +1 -exec rm \;;}: syntax error at (eval 44128) line 1, near "*."

auch dießen Code
([DU_Test]) ("{find tor/test/*.jpg -mtime +1 -exec rm {} \;;}")

geht auch nicht :-[

Gruß BlasterX
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Morgennebel am 15 September 2017, 20:50:28
Verpack den find-Befehl in ein Bash-Script mit sprechendem Namen und rufe diesen vom DOIF aus auf...

Rechte muessen entsprechend passen.

Ciao, -MN
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 15 September 2017, 21:02:40
@ Morgennebel

Das ist eine Möglichkeit,aber da kann ich es auch über die 99_myUtils.pm machen und über ein DOIF starten. Mit der 99_myUtils.pm geht es ja auch. Aber mich Interessiert warum es nicht mit dem DOIF direkt geht.

Gruß BlasterX
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Ellert am 16 September 2017, 14:44:04
([DU_Test]) ("find tor/test/*.jpg -mtime +1 -exec rm {} \;;")

Systembefehle werden in doppelte Anführungszeichen eingeschlossen, siehe https://fhem.de/commandref_DE.html#command erster Satz.
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 16 September 2017, 15:04:18
@Ellert

Genau dießen Code habe ich auch getestet doch mit dem ausführen des DOIF's wird nichts gelöscht. Und ich bekomme auch keine Fehlermeldung. :-[

Gruß BlasterX
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Ellert am 16 September 2017, 15:59:12
Gezeigt hast Du aber:

{system ('find tor/test/*.jpg -mtime +1 -exec rm {} \;;')}

und das

("{find tor/test/*.jpg -mtime +1 -exec rm {} \;;}")

und das

("{find tor/test/*.jpg -mtime +1 -exec rm {} \;;}")

Das alles ist anders als das, was ich schrieb:

("find tor/test/*.jpg -mtime +1 -exec rm {} \;;")

Funktioniert es in der Befehlszeile?
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 16 September 2017, 16:15:26
Ich habe nicht alle Versuche von Codes gepostet es waren so viele.(trial and error) Die Codes die ich getestet habe habe ich mir aufgeschrieben und Deiner war auch dabei.
Wenn ich Deinen Code so in die Befehlszeile eingebe
("find tor/test/*.jpg -mtime +1 -exec rm {} \;;")
kommt folgende Fehlermeldung
Unknown command ("find, try help.
Gebe ich ihn so ein
{"find tor/test/*.jpg -mtime +1 -exec rm {} \;;"}
kommt die Meldung
find tor/test/*.jpg -mtime +1 -exec rm {} ;
aber nichts wird gelöscht

Gruß BlasterX
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Ma_Bo am 16 September 2017, 16:34:48
Zitat von: blasterx am 16 September 2017, 16:15:26
Ich habe nicht alle Versuche von Codes gepostet es waren so viele.(trial and error) Die Codes die ich getestet habe habe ich mir aufgeschrieben und Deiner war auch dabei.
Wenn ich Deinen Code so in die Befehlszeile eingebe
("find tor/test/*.jpg -mtime +1 -exec rm {} \;;")
kommt folgende Fehlermeldung
Unknown command ("find, try help.
Gebe ich ihn so ein
{"find tor/test/*.jpg -mtime +1 -exec rm {} \;;"}
kommt die Meldung
find tor/test/*.jpg -mtime +1 -exec rm {} ;
aber nichts wird gelöscht

Gruß BlasterX

Das ist klar, gib ihn mal so ein:

"find tor/test/*.jpg -mtime +1 -exec rm {} \;;"



Tapatalk iPhone, daher kurz gehalten.
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 16 September 2017, 16:55:41
Danke für die schnelle Antwort. Mein Fehler das mit den Klannern einzugeben, wie Doof auch von mir :-[. Der Code ohne den Klammern in der Befehlszeile klappt wunderbar und die Bilddateien werden gelöscht. Aber warum nicht mit dem DOIF?

Gruß BlasterX
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: Ellert am 16 September 2017, 17:52:14
Zitat von: blasterx am 16 September 2017, 16:55:41
Danke für die schnelle Antwort. Mein Fehler das mit den Klannern einzugeben, wie Doof auch von mir :-[. Der Code ohne den Klammern in der Befehlszeile klappt wunderbar und die Bilddateien werden gelöscht. Aber warum nicht mit dem DOIF?

Gruß BlasterX

Ich vermute es liegt an den {}, die scheint DOIF nicht zu mögen.

("find tor/test/*.jpg -mtime +1 -delete") sollte funktionieren.
Titel: Antw:Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?
Beitrag von: blasterx am 16 September 2017, 17:59:25
@Ellert
Danke für die Antwort. Den Code den du gerade gepostet hast funktioniert.
Da komme ich mit dem Projekt Türsprechanlage weiter. Danke.

Gruß BlasterX