Cron Job wird nicht ausgeführt

  • Hallo.
    nun habe ich folgende Problem, ich will meine Filme zyklisch auf eine andere Platte sichern.


    Crontab:

    Code
    # m h dom mon dow user	command
    17 *	* * *	root   cd / && run-parts --report /etc/cron.hourly
    25 6	* * *	root	test-x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report/etc/cron.weekly )
    52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report/etc/cron.monthly )
    02 18    * * 1,0,3 root    /var/Synchronisation/archive-filme.sh      #   Fimsicherung jeden Sonntag, Mittwoch 2 Uhr früh


    Die File dich ich aufrufe:

    Code
    echo $(date) "Film-Synchronisation START" >> Sync.log
    rsync -r -t -p -o -g -v --progress --size-only --partial -s --delete /daten/video-dir/filme/ /Archive/Film-Sicherung/video-dir/filme/
    echo $(date) "Film-Synchronisation ENDE " >> Sync.log


    Und die syslog Ausgabe:

    Code
    Aug 29 18:01:12 VDR-Server vdr: [3491] channel 15 (VOX Austria) event Mo. 29.08.2016 18:00-19:00 'mieten, kaufen, wohnen' status 4
    Aug 29 18:02:01 VDR-Server CRON[14419]: (root) CMD (/var/Synchronisation/archive-filme.sh      #   Fimsicherung jeden Sonntag, Mittwoch 2 Uhr fr\303\274h)
    Aug 29 18:02:34 VDR-Server vdr: [3491] channel 11 (ZDF) event Mo. 29.08.2016 17:45-18:05 (VPS: 29.08. 17:45) 'Leute heute' status 1


    Wenn ich den Sript manuell aufrufe funktioniert er. Er sichert und schreibt in die eigene Logfile.
    Nach dem Aufruf durch Cron steht aber nichts im Sync.log. Die erforderlichen Rechte habe ich gesetzt.


    Bitte um einen Tipp.
    Danke
    hansp

    Server:
    ASROCK J4125 ITX Board, 8GB Ram, 18TB Platte, 2x Tevii S460,
    Ubuntu 22.04LTS, 3xRaspberry-LibreElec, 1xVomp, yaVDR 22.2.0-12

  • Code
    25 6	* * *	root	test-x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

    Fehlt da nicht ein Leerzeichen hinter test?


    Code
    02 18    * * 1,0,3 root    /var/Synchronisation/archive-filme.sh      #   Fimsicherung jeden Sonntag, Mittwoch 2 Uhr früh


    Die Manpage sagt dazu:

    Blank lines and leading spaces and tabs are ignored. Lines whose first non-space character is a pound-sign (#) are comments, and are ignored. Note that comments are not allowed on the same line as cron commands, since they will be taken to be part of the command. Similarly, comments are not allowed on the same line as environment variable settings.

    yaVDR-Dokumentation (Ceterum censeo enchiridia esse lectitanda.)

  • Jetzt bin ich mir nicht sicher, ob
    - es nicht besser wäre, bei dem Script ein Shebang zu setzen oder es mit "sh /var/Synch..." aufzurufen.
    - ob das Shellscript auch die executeable-Rechte gesetzt hat
    - ob rsync mit "--progress" nicht ein "controlling terminal" benötigt, um zu laufen.

  • Danke für die Hinweise.
    Die Zeile mit dem test habe ich aus der original crontab rauskopiert vielleicht ist da was beim Zeilenumbruch passiert.
    Ich habe jetzt meinen Kommentar entfernt, aber leider immer noch nichts.
    Allerdings steht beim cron restart folgendes in des sslog:

    Code
    Aug 29 20:30:50 VDR-Server cron[18459]: (CRON) INFO (pidfile fd = 3)
    Aug 29 20:30:50 VDR-Server kernel: [178228.547517] init: cron main process (18293) killed by TERM signal
    Aug 29 20:30:50 VDR-Server cron[18460]: (CRON) STARTUP (fork ok)
    Aug 29 20:30:50 VDR-Server cron[18460]: (CRON) INFO (Skipping @reboot jobs -- not system startup)


    Die Criontab:

    Code
    17 *	* * *	root	cd / && run-parts --report /etc/cron.hourly
    25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    32 20	* * 1,0,3 root	/var/Synchronisation/archive-filme.sh

    Server:
    ASROCK J4125 ITX Board, 8GB Ram, 18TB Platte, 2x Tevii S460,
    Ubuntu 22.04LTS, 3xRaspberry-LibreElec, 1xVomp, yaVDR 22.2.0-12

  • Jetzt ist in der syslog doch noch das aufgetaucht, Aber warum macht der Scriot nichts?

    Code
    Aug 29 20:32:01 VDR-Server CRON[18505]: (root) CMD (   /var/Synchronisation/archive-filme.sh)


    Nochmal, was gehört jetzt zwischen root und dem Kommando? Ein Blank?

    Server:
    ASROCK J4125 ITX Board, 8GB Ram, 18TB Platte, 2x Tevii S460,
    Ubuntu 22.04LTS, 3xRaspberry-LibreElec, 1xVomp, yaVDR 22.2.0-12

  • executable Rechte habe ich gesetzt.
    Hier ein Beispiel vom Cron Wiki

    Code
    5    9-20 * * *   /home/BENUTZERNAME/script/script1.sh > /dev/null


    da wird das Script auch einfach aufgerufen. Controlling terminal und shebang kenne ich nicht.

    Server:
    ASROCK J4125 ITX Board, 8GB Ram, 18TB Platte, 2x Tevii S460,
    Ubuntu 22.04LTS, 3xRaspberry-LibreElec, 1xVomp, yaVDR 22.2.0-12

  • Soweit ich weiß kann man Leerzeichen oder Tabs verwenden. Außerdem muss die Crontab mit einem Kommentar oder einer Leerzeile enden.

    yaVDR-Dokumentation (Ceterum censeo enchiridia esse lectitanda.)

  • danke für deine Hilfe today. habe noch die Kommentarzeile eingefügt und dann ist mit auch schon der Fehler aufgefallen. Ich habe den Pfad vergessen.
    Muss so heißen:

    Code
    echo $(date) "Film-Synchronisation START" >> /var/Synchronisation/Sync.log
    rsync -r -t -p -o -g -v --progress --size-only --partial -s --delete /daten/video-dir/filme/ /Archive/Film-Sicherung/video-dir/filme/
    echo $(date) "Film-Synchronisation ENDE " >> /var/Synchronisation/Sync.log

    Server:
    ASROCK J4125 ITX Board, 8GB Ram, 18TB Platte, 2x Tevii S460,
    Ubuntu 22.04LTS, 3xRaspberry-LibreElec, 1xVomp, yaVDR 22.2.0-12

Jetzt mitmachen!

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