Der Befehl wird im DOIF nicht ausgeführt aber im Notify schon warum?

Begonnen von blasterx, 15 September 2017, 19:43:44

Vorheriges Thema - Nächstes Thema

blasterx

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
Gruß-BlasterX

Ma_Bo

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.
NUC mit FHEM, HM Heizungsthermostate, HM Wandthermostate, Intertechno Funksteckdosen, 10" Tablet als Wanddisplay, KeyMatic, Fensterkontakte, Fensterkontakte umgebaut als Wassermelder und Briefkastenmelder, Aussenthermostat, Anwesenheitssteuerung über Fritz Box, Google Home usw. usw.

blasterx

@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
Gruß-BlasterX

Ma_Bo

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


Tapatalk iPhone, daher kurz gehalten.
NUC mit FHEM, HM Heizungsthermostate, HM Wandthermostate, Intertechno Funksteckdosen, 10" Tablet als Wanddisplay, KeyMatic, Fensterkontakte, Fensterkontakte umgebaut als Wassermelder und Briefkastenmelder, Aussenthermostat, Anwesenheitssteuerung über Fritz Box, Google Home usw. usw.

blasterx

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
Gruß-BlasterX

Morgennebel

Verpack den find-Befehl in ein Bash-Script mit sprechendem Namen und rufe diesen vom DOIF aus auf...

Rechte muessen entsprechend passen.

Ciao, -MN
Einziger Spender an FHEM e.V. mit Dauerauftrag seit >= 24 Monaten

FHEM: MacMini/ESXi, 2-3 FHEM Instanzen produktiv
In-Use: STELLMOTOR, VALVES, PWM-PWMR, Xiaomi, Allergy, Proplanta, UWZ, MQTT,  Homematic, Luftsensor.info, ESP8266, ESERA

blasterx

@ 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
Gruß-BlasterX

Ellert

([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.

blasterx

@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
Gruß-BlasterX

Ellert

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?

blasterx

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
Gruß-BlasterX

Ma_Bo

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.
NUC mit FHEM, HM Heizungsthermostate, HM Wandthermostate, Intertechno Funksteckdosen, 10" Tablet als Wanddisplay, KeyMatic, Fensterkontakte, Fensterkontakte umgebaut als Wassermelder und Briefkastenmelder, Aussenthermostat, Anwesenheitssteuerung über Fritz Box, Google Home usw. usw.

blasterx

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
Gruß-BlasterX

Ellert

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.

blasterx

@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
Gruß-BlasterX