Raspbian Crontab

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von petaod.

    Raspbian Crontab

    Hallo zusammen,

    ich habe mal eine Frage zum Crontab in Raspbian. Ich musste leider aufgrund eines Softwarefehlers meinen Pi zurücksetzten.

    Der Pi hat alle 30 Minuten eine lokale Adresse aufgerufen, welcher ein PHP-Script ausführen soll.

    Der ursprüngliche Befehl (hatte zuvor funktioniert) lautet:
    30 * * * * curl http://192.168.178.2/external_ip.php

    wenn ich
    curl http://192.168.178.2/external_ip.php

    im Terminal manuell eingebe, dann geschieht auch alles wie es soll. Ich weiß aber nicht, wieso das ganze nicht mehr als Cronjob ausgeführt wird.

    Ich habe das ganze jetzt in mehrere Variationen durchgetestet.
    Schritt 1: sudo crontab -e

    Schritt 2: Am Ende der Datei:
    habe ich folgendes alles ausprobiert:

    Quellcode

    1. 30 * * * * curl http://192.168.178.2/external_ip.php
    2. 30 * * * * root curl http://192.168.178.2/external_ip.php
    3. @hourly curl http://192.168.178.2/external_ip.php
    4. @hourly /usr/bin/curl http://192.168.178.2/external_ip.php


    Schritt 3: sudo service cron restart

    Ein Blick ins Log sagt mir, dass der Cronjob zumindest als User Pi ausgeführt wurde:

    Quellcode

    1. Sep 10 11:07:53 raspberrypi cron[352]: (CRON) INFO (pidfile fd = 3)
    2. Sep 10 11:07:53 raspberrypi cron[352]: (CRON) INFO (Running @reboot jobs)
    3. Sep 10 11:09:09 raspberrypi CRON[1390]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
    4. Sep 10 11:10:11 raspberrypi cron[344]: (CRON) INFO (pidfile fd = 3)
    5. Sep 10 11:10:11 raspberrypi cron[344]: (CRON) INFO (Running @reboot jobs)
    6. Sep 10 11:12:56 raspberrypi cron[1519]: (CRON) INFO (pidfile fd = 3)
    7. Sep 10 11:12:56 raspberrypi cron[1519]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    8. Sep 10 11:15:51 raspberrypi cron[1578]: (CRON) INFO (pidfile fd = 3)
    9. Sep 10 11:15:51 raspberrypi cron[1578]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    10. Sep 10 11:17:01 raspberrypi CRON[1586]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    11. Sep 10 11:18:36 raspberrypi cron[1663]: (CRON) INFO (pidfile fd = 3)
    12. Sep 10 11:18:36 raspberrypi cron[1663]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    13. Sep 10 11:20:42 raspberrypi cron[1759]: (CRON) INFO (pidfile fd = 3)
    14. Sep 10 11:20:42 raspberrypi cron[1759]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    15. Sep 10 11:23:02 raspberrypi cron[1844]: (CRON) INFO (pidfile fd = 3)
    16. Sep 10 11:23:02 raspberrypi cron[1844]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    17. Sep 10 11:26:59 raspberrypi cron[1901]: (CRON) INFO (pidfile fd = 3)
    18. Sep 10 11:26:59 raspberrypi cron[1901]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    19. Sep 10 11:30:01 raspberrypi CRON[1935]: (pi) CMD (pi curl http://192.168.178.2/external_ip.php)
    20. Sep 10 11:30:01 raspberrypi CRON[1931]: (CRON) info (No MTA installed, discarding output)


    Was mir schon helfen würde, wäre eine Option um einen Cronjob manuell auszuführen.

    Hat vielleicht Jemand von euch eine Idee?

    LG Marvin

    Code-Tags eingefügt. ~Thunderbolt

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Thunderbolt“ ()