executeCommandLine - CURL

Hello,

i am trying to write a rule to take a picture from my doorphone by motion.
Unfortunately it don’t work with this commands:

rule "take pic on motion"
when 
    Item OA_Gateway_MotionTest received update 
then 
{
    val url = "http://192.168.0.58:8080/picture.jpg"
    val outputFile = "/home/user/Downloads/" + now.toString.replaceAll("[:\\/ ]+", "_") + ".jpg"
    var cmd = "curl -m 10 -o " + outputFile + " " + url
    executeCommandLine(cmd)
    logInfo("MotionRule", cmd)
}end

The Log writes the right command (checked on commandLine itself)
Is there any hint with executeCommandLine with curl?

best regards
wu3mi

val results = executeCommandLine(cmd)
logInfo("MotionRule", cmd + results)

It’s often a permissions issue

Check the permission of the directory /home/user/Downloads/. E.g. with the command

ls -ld /home/user/Downloads

Is it writeable for the user that is owning the process openhab software is running under ( user openhab ) ?

Hello,

thx for the fast reply …
It works now with the hint from @rossko57

The permissions issue was my first idea, tbh, i don’t know , why rosskos57’s hint works …

but thanks to you
regards
wu3mi

It’s not a fix, just reports error messages that you might not have seen.

You’v done something else to “fix” it.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.