Command works fine in shell, but fails in scheduled job

  • Running this command in ShellInABox does what it should:


    IP=`curl -s dynamicdns.park-your-domain.com/getip` && curl "https://dynamicdns.park-your-domain.com/update?host=@&domain=example.com&password=examplePassword=$IP"


    but putting that exact same line into the "Command" field of scheduled jobs gives this error:



    What could be causing this?

    • Offizieller Beitrag

    Try using full and precise paths for everything.


    Instead of running several commands, run a prepared script. Makes debugging easier.


    Don't use sudo if you run the cron job as root.


    I never use OMV for scheduled jobs. I edit /etc/crontab. Feels much simpler and direct. But that may be because that was how I was used to do it long before I started using OMV.

  • Put the commands in a shell script and changed the command in scheduled jobs to execute that script and it works. Weird that it doesn't like to directly execute the same commands through the UI command field.

    • Offizieller Beitrag

    That command only uses web urls (so no paths used) and it also doesn't use sudo. I'll give a prepared script approach a try. Will post back with findings.

    You run curl without specifying the path to curl? It might work better if you specified the path?


    But good that you got it working with a prepared script.


    I typically run ...

    Code
    /bin/bash /path/to/script.sh >> /path/to/script.log


    ... as root from crontab.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!