cron.d not working

  • hallo,


    habe einen test-cronjob angelegt, welcher aber nicht ausgeführt wird

    Code
    root@testsrv /tmp # cat /etc/cron.d/test.cron 
    3 * * * * root echo "hallo"  >> /tmp/test.log


    dann habe ich

    Code
    service cron restart


    ausgeführt

    Code
    root@testsrv /tmp # crontab -l
    no crontab for root
    1 root@testsrv /tmp # ls -la
    total 8
    drwxrwxrwt  2 root root 4096 Apr 19 16:00 ./
    drwxr-xr-x 23 root root 4096 Apr 19 14:14 ../
    root@testsrv /tmp # date
    Sat Apr 19 16:04:24 CEST 2014
    root@testsrv /tmp #


    was mache ich falsch?

  • crontab -e

    1. Server Zotac D2700-ITS Cine-S2 Dual yaVDR 0.5
    2. Client Zotac D2550-ITS yaVDR 0.5
    Sonstige VDRs
    2. Zotac-HD-ID11 TT-S2-3600 yaVDR 0.5
    3. Zotac D2700-ITS TT-S2-3600 yaVDR 0.5
    4. Zotac ITX-F-E TT-S2-3600 yaVDR 0.5

  • Pfad zu echo angeben?

  • Sorry, ich hätte es gleich sagen sollen, wollte es nur nicht unnötig verkomplizieren, aber ich will das dann nicht in einem script sondern das file über puppet da platzieren. Wenn ich so wie vorgeschlagen machen würde, würde der puppet agent mir alle 30 min den selben cronjob anlegen.


    Irgendwie muss das ja mit dem cron.d Verzeichnis auch funktionieren.

  • Das File in "/etc/cron.d" muss so aussehen:


    Code
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    #
    3 * * * * root echo "hallo"  >> /tmp/test.log


    Wobei das Verzeichnis "/etc/crontab" besser dafür geeignet wäre. ;)

  • in cron ein script eintragen (absoluter pfad)
    script ist ausführbar (chmod +x)
    shebang als erste zeile im script (#!/bin/bash)


    läuft...

Jetzt mitmachen!

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