Skip to content
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Off Topic
  4. crontab funktioniert nicht (Gelöst)

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.0k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.8k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.0k

crontab funktioniert nicht (Gelöst)

crontab funktioniert nicht (Gelöst)

Scheduled Pinned Locked Moved Off Topic
14 Posts 6 Posters 893 Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MichaelFM MichaelF

    Hi, ich habe hier ein kleines Script was ich über die crontab Funktion ausführen möchte.

    # Edit this file to introduce tasks to be run by cron.
    #
    # Each task to run has to be defined through a single line
    # indicating with different fields when the task will be run
    # and what command to run for the task
    #
    # To define the time you can provide concrete values for
    # minute (m), hour (h), day of month (dom), month (mon),
    # and day of week (dow) or use '*' in these fields (for 'any').
    #
    # Notice that tasks will be started based on the cron's system
    # daemon's notion of time and timezones.
    #
    # Output of the crontab jobs (including errors) is sent through
    # email to the user the crontab file belongs to (unless redirected).
    #
    # For example, you can run a backup of all your user accounts
    # at 5 a.m every week with:
    # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
    #
    # For more information see the manual pages of crontab(5) and cron(8)
    #
    # m h  dom mon dow   command
    5 0 * * * /home/pi/evcc-influx-aggregate.sh --yesterday >> /var/log/evcc-grafana-dashboards.log 2>&1
    0 * * * * /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&
    

    Das ganze Läuft auf einem Pi3 mit bullseye.

    Problem ist das er das Script nicht ausführt, den Log habe ich bereits aktiviert aber so richtig schlau werde ich daraus auch nicht:

    Oct  4 00:00:01 Influxdb1 CRON[22687]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&)
    Oct  4 00:00:01 Influxdb1 CRON[22686]: (CRON) info (No MTA installed, discarding output)
    Oct  4 00:05:01 Influxdb1 CRON[22913]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --yesterday >> /var/log/evcc-grafana-dashboards.log 2>&1)
    Oct  4 00:05:01 Influxdb1 CRON[22912]: (CRON) info (No MTA installed, discarding output)
    Oct  4 00:17:01 Influxdb1 CRON[23440]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Oct  4 01:00:02 Influxdb1 CRON[25350]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&)
    Oct  4 01:00:02 Influxdb1 CRON[25349]: (CRON) info (No MTA installed, discarding output)
    Oct  4 01:17:01 Influxdb1 CRON[26193]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Oct  4 02:00:01 Influxdb1 CRON[28274]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&)
    Oct  4 02:00:01 Influxdb1 CRON[28273]: (CRON) info (No MTA installed, discarding output)
    Oct  4 02:17:01 Influxdb1 CRON[29083]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Oct  4 03:00:01 Influxdb1 CRON[31036]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&)
    Oct  4 03:00:01 Influxdb1 CRON[31035]: (CRON) info (No MTA installed, discarding output)
    Oct  4 03:10:01 Influxdb1 CRON[31562]: (root) CMD (test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r)
    Oct  4 03:17:01 Influxdb1 CRON[32089]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Oct  4 04:00:01 Influxdb1 CRON[1568]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&)
    Oct  4 04:00:01 Influxdb1 CRON[1567]: (CRON) info (No MTA installed, discarding output)
    Oct  4 04:17:01 Influxdb1 CRON[2355]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Oct  4 05:00:01 Influxdb1 CRON[4285]: (pi) CMD (root /home/pi/evcc-influx-aggregate.sh --today >> /var/log/evcc-grafana-dashboards.log 2>&)
    Oct  4 05:00:01 Influxdb1 CRON[4284]: (CRON) info (No MTA installed, discarding output)
    Oct  4 05:17:01 Influxdb1 CRON[5069]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    

    Wenn ich in der console eingebe

    /home/pi/evcc-influx-aggregate.sh --yesterday
    

    wird es ausgeführt aber leider nicht im crontab.

    Die Log Datei wird ebenfalls nicht angelegt, warum kann ich ehrlichgesagt auch nicht sagen.

    Wenn noch Infos fehlen, nur sagen.

    Vielleicht hat ja hier jemand eine Idee wo mein Fehler ist, wäre cool.

    Grüße

    DolomitiD Online
    DolomitiD Online
    Dolomiti
    wrote on last edited by
    #2

    @michaelf
    Das könnte ein Rechteproblem sein. Ich hatte das auch mal bei einem Skript. Ich weiß aber nicht mehr wie ich das Problem gelöst habe.
    Wie hast du den Eintrag in der crontab erstellt? Mit crontab -e oder mit sudo crontab -e. Das macht einen Unterschied.

    Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
    Intel N100 (32GB,256GB SSD), Proxmox -> Debian 12 in VM (Master) + Debian 12 in CT (Test) + Debmatic, HM-Aktoren, Wago 750-880, Shelly, Zigbee

    MichaelFM 1 Reply Last reply
    0
    • DolomitiD Dolomiti

      @michaelf
      Das könnte ein Rechteproblem sein. Ich hatte das auch mal bei einem Skript. Ich weiß aber nicht mehr wie ich das Problem gelöst habe.
      Wie hast du den Eintrag in der crontab erstellt? Mit crontab -e oder mit sudo crontab -e. Das macht einen Unterschied.

      MichaelFM Offline
      MichaelFM Offline
      MichaelF
      wrote on last edited by
      #3

      @dolomiti sagte in crontab funktioniert nicht:

      @michaelf
      Das könnte ein Rechteproblem sein. Ich hatte das auch mal bei einem Skript. Ich weiß aber nicht mehr wie ich das Problem gelöst habe.
      Wie hast du den Eintrag in der crontab erstellt? Mit crontab -e oder mit sudo crontab -e. Das macht einen Unterschied.

      Hi, nur mit crontab -e

      ? Meister MopperM 2 Replies Last reply
      0
      • MichaelFM MichaelF

        @dolomiti sagte in crontab funktioniert nicht:

        @michaelf
        Das könnte ein Rechteproblem sein. Ich hatte das auch mal bei einem Skript. Ich weiß aber nicht mehr wie ich das Problem gelöst habe.
        Wie hast du den Eintrag in der crontab erstellt? Mit crontab -e oder mit sudo crontab -e. Das macht einen Unterschied.

        Hi, nur mit crontab -e

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #4

        @michaelf

        Die Antwort, warum es wahrscheinlich nicht geht, steht direkt darunter - "No MTA installed"
        Das wird ja meistens mit "Message Transfer Agent" übersetzt.
        Ich denke der meint, er müsste die Ausgabe irgendwo hinschicken.

        Mach mal Hochkommas um diesen Aufruf in der CRONTAB
        (/home/pi/evcc-influx-aggregate.sh --yesterday), oder lass zum Testen
        das ganze Logzeug in der CRONTAB weg.
        Oder gib wenigstens im Konsolenfenster das mal mit dem Log-Statement ein und nicht nur
        die Hälfte.

        1 Reply Last reply
        1
        • MichaelFM MichaelF

          @dolomiti sagte in crontab funktioniert nicht:

          @michaelf
          Das könnte ein Rechteproblem sein. Ich hatte das auch mal bei einem Skript. Ich weiß aber nicht mehr wie ich das Problem gelöst habe.
          Wie hast du den Eintrag in der crontab erstellt? Mit crontab -e oder mit sudo crontab -e. Das macht einen Unterschied.

          Hi, nur mit crontab -e

          Meister MopperM Away
          Meister MopperM Away
          Meister Mopper
          wrote on last edited by
          #5

          @michaelf sagte in crontab funktioniert nicht:

          Hi, nur mit crontab -e

          Und als welcher User hast du das ausgeführt, hoffentlich nicht als root.

          Der User erstellt seinen Zeitplan mit crontab -e. Soll root dies ausühren, wird vom User sudo crontab -e ausgeführt.
          Ist man jedoch (fälschlicherweise) als root eingeloggt, führt crontab -e logischerweise auch einen root-crontab aus.

          Tel Aviv, Mondamin

          Proxmox und HA

          MichaelFM 1 Reply Last reply
          0
          • Meister MopperM Meister Mopper

            @michaelf sagte in crontab funktioniert nicht:

            Hi, nur mit crontab -e

            Und als welcher User hast du das ausgeführt, hoffentlich nicht als root.

            Der User erstellt seinen Zeitplan mit crontab -e. Soll root dies ausühren, wird vom User sudo crontab -e ausgeführt.
            Ist man jedoch (fälschlicherweise) als root eingeloggt, führt crontab -e logischerweise auch einen root-crontab aus.

            Tel Aviv, Mondamin

            MichaelFM Offline
            MichaelFM Offline
            MichaelF
            wrote on last edited by
            #6

            @meister-mopper

            Nein kein root. pi quasi Standard.

            pi@Influxdb1:~ $ /home/pi/evcc-influx-aggregate.sh --yesterday >> /var/log/evcc-grafana-dashboards.log 2>&1
            -bash: /var/log/evcc-grafana-dashboards.log: Keine Berechtigung
            

            in der tat ein Berechtigungs Problem, wie kann ich das lösen ?

            Thomas BraunT 1 Reply Last reply
            0
            • MichaelFM MichaelF

              @meister-mopper

              Nein kein root. pi quasi Standard.

              pi@Influxdb1:~ $ /home/pi/evcc-influx-aggregate.sh --yesterday >> /var/log/evcc-grafana-dashboards.log 2>&1
              -bash: /var/log/evcc-grafana-dashboards.log: Keine Berechtigung
              

              in der tat ein Berechtigungs Problem, wie kann ich das lösen ?

              Thomas BraunT Online
              Thomas BraunT Online
              Thomas Braun
              Most Active
              wrote on last edited by
              #7

              @michaelf sagte in crontab funktioniert nicht:

              in der tat ein Berechtigungs Problem, wie kann ich das lösen ?

              Erstmal schauen welche Rechte auf dem File liegen...
              Bzw. darf der pi mit Sicherheit nicht in das /var/log/evcc-grafana-dashboards.log schreiben. Warum solllte er auch.

              Linux-Werkzeugkasten:
              https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
              NodeJS Fixer Skript:
              https://forum.iobroker.net/topic/68035/iob-node-fix-skript
              iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

              1 Reply Last reply
              0
              • MichaelFM Offline
                MichaelFM Offline
                MichaelF
                wrote on last edited by
                #8

                Die Datei habe ich grade mal mit

                sudo nano
                

                erstellt, war ja auch nicht vorhanden.

                Rechte:

                -rw-r--r--  1 root     root                    0  5. Okt 18:47 evcc-grafana-dashboards.log
                
                Thomas BraunT 1 Reply Last reply
                0
                • MichaelFM MichaelF

                  Die Datei habe ich grade mal mit

                  sudo nano
                  

                  erstellt, war ja auch nicht vorhanden.

                  Rechte:

                  -rw-r--r--  1 root     root                    0  5. Okt 18:47 evcc-grafana-dashboards.log
                  
                  Thomas BraunT Online
                  Thomas BraunT Online
                  Thomas Braun
                  Most Active
                  wrote on last edited by
                  #9

                  @michaelf
                  Dann kannst du es dir ja auch selber beantworten. Der root darf lesen und schreiben, alle anderen nur lesen. Also knallt der kleine pi da vor die Wand.

                  Linux-Werkzeugkasten:
                  https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
                  NodeJS Fixer Skript:
                  https://forum.iobroker.net/topic/68035/iob-node-fix-skript
                  iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

                  1 Reply Last reply
                  0
                  • MichaelFM Offline
                    MichaelFM Offline
                    MichaelF
                    wrote on last edited by MichaelF
                    #10

                    wäre das dann:

                    chown pi evcc-grafana-dashboards.log
                    

                    und für das schreiben:

                    chmod 660 evcc-grafana-dashboards.log
                    

                    Ich bin leider noch nicht sooooooo firm was das angeht.

                    Thomas BraunT 1 Reply Last reply
                    0
                    • MichaelFM MichaelF

                      wäre das dann:

                      chown pi evcc-grafana-dashboards.log
                      

                      und für das schreiben:

                      chmod 660 evcc-grafana-dashboards.log
                      

                      Ich bin leider noch nicht sooooooo firm was das angeht.

                      Thomas BraunT Online
                      Thomas BraunT Online
                      Thomas Braun
                      Most Active
                      wrote on last edited by
                      #11

                      @michaelf

                      Zunächst mal würde ich sowas nicht in ein /home eines users pflanzen, sondern nach /usr/local/bin
                      Gibt es nicht schon für evcc einen entsprechenden user? Dann würde ich auch den das Skript ausführen lassen.
                      Rechte dann entsprechend an den user oder eine passende Gruppe vergeben.

                      Linux-Werkzeugkasten:
                      https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
                      NodeJS Fixer Skript:
                      https://forum.iobroker.net/topic/68035/iob-node-fix-skript
                      iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

                      MichaelFM 1 Reply Last reply
                      0
                      • Thomas BraunT Thomas Braun

                        @michaelf

                        Zunächst mal würde ich sowas nicht in ein /home eines users pflanzen, sondern nach /usr/local/bin
                        Gibt es nicht schon für evcc einen entsprechenden user? Dann würde ich auch den das Skript ausführen lassen.
                        Rechte dann entsprechend an den user oder eine passende Gruppe vergeben.

                        MichaelFM Offline
                        MichaelFM Offline
                        MichaelF
                        wrote on last edited by
                        #12

                        @thomas-braun

                        Nein auf dem Pi ist quasi nur eine Influx Datenbank, wo aber auch Evcc hineinschreibt.

                        User ist nur der pi vorhanden, das script ist quasi auch ein allgemeines es vereinfacht Grafana das rechnen mit Monats und Jahreswerten die quasi direkt in die Influx Datenbank geschrieben werden.

                        MartinPM 1 Reply Last reply
                        0
                        • MichaelFM MichaelF

                          @thomas-braun

                          Nein auf dem Pi ist quasi nur eine Influx Datenbank, wo aber auch Evcc hineinschreibt.

                          User ist nur der pi vorhanden, das script ist quasi auch ein allgemeines es vereinfacht Grafana das rechnen mit Monats und Jahreswerten die quasi direkt in die Influx Datenbank geschrieben werden.

                          MartinPM Online
                          MartinPM Online
                          MartinP
                          wrote on last edited by
                          #13

                          @michaelf das ENV innerhalb von cron ist limitiert.
                          Vielleicht fehlt etwas im Pfad.
                          Ich kopiere des Pfad aus dem normalen Terminalfenster oben in die Shell-Scripts, die ich durch cron ausführen lassen will

                          Intel(R) Celeron(R) CPU N3000 @ 1.04GHz 8G RAM 480G SSD
                          Virtualization : unprivileged lxc container (debian 12 on Proxmox 8.4.13)
                          kernel Linux pve 6.8.12-15-pve
                          6 GByte RAM für den Container
                          Fritzbox 6591 FW 8.03 (Vodafone Leih-Box)
                          Remote-Access über Wireguard der Fritzbox

                          1 Reply Last reply
                          0
                          • MichaelFM Offline
                            MichaelFM Offline
                            MichaelF
                            wrote on last edited by
                            #14

                            Danke an alle, Funktioniert jetzt. Lösung war die Berechtigung.

                            Grüße

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            596

                            Online

                            32.4k

                            Users

                            81.3k

                            Topics

                            1.3m

                            Posts
                            Community
                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                            ioBroker Community 2014-2025
                            logo
                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Recent
                            • Tags
                            • Unread 0
                            • Categories
                            • Unreplied
                            • Popular
                            • GitHub
                            • Docu
                            • Hilfe