Search code examples
crondirectadmin

How to sync crontab with DirectAdmin backwards?


I have a few hundred cronjobs in DirectAdmin.

I need to string_replace every cronjob in DirectAdmin.

I managed to change all my cronjobs with crontab -e, so my cronfile in /var/spool/cron is now correct.

The problem is that in DirectAdmin only the old cronjobs reside.

My question is how to sync the string-replaced crons into DirectAdmin ?

So is there a way to read the changed /var/spool/cron-file into DirectAdmin ?


Solution

  • You better not use crontab -u userfoo -e to change your crons directly, because DirectAdmin will be unchanged.

    This is better:

    Step1: Open /usr/local/directadmin/data/users/userfoo/crontab.conf and add “0=”, “1=”, “2=”, etc. before every line: (don't use this before a comment line):

    1=1 * * * * /usr/local/bin/php /home/userfoo/domains/www.domfoo.nl/public_html/foo1.php
    
    2=* 2 * * * /usr/local/bin/php /home/userfoo/domains/www.domfoo.nl/public_html/foo2.php
    

    Step2: Go to DirectAdmin, cronjobs and click right-below on Save (This will copy the crons to /var/spool/cron/)

    All your crons will be active on-the-fly.