custom directadmin_cron

rlahaise

Verified User
Joined
Jan 12, 2022
Messages
13
I would like to change the directadmin_cron (/etc/cron.d/directadmin_cron) and it needs to be persistent after a DirectAdmin update. Is there a /usr/local/directadmin/data/templates/custom file that I need to create?

I looked in the docs/forum but I haven't been able to find the answer. On a side note, I do know that I can chattr the file to prevent any changes but if possible I would like to avoid this.
 
As far as I know for that cronjob there is no specific custom thing to be made.

However, maybe if you explain what you want to change in it? Might be that there are custom things to do that.
For example, there are some custom post and pre things which can be done when creating a new domain for example.
 
I need to change the default time when the nightly tally=all is executed, I have now made the file immutable as a temporary solution but I'm still curious if there is another way.
 
Starting DA version 1.63.7 file /etc/cron.d/directadmin_cron is always replaced on DA update meaning any local modifications would get overwritten after update.

Key reason was eliminating the periodic license refresh call to getLicense.sh (which is no longer necessary in the latest DA versions). But we also think there should be no need to customize this file. And in the future we plan to move dataskq execution from cron into the directadmin service. We expected execution times in the standard cron script were good enough for everyone.

It would be great to better understand the reasons, why one would like to change it. @rlahaise could you give us more details why would you like to change the action=tally&value=all execution time? @Erulezz you are referring to customized action=vacation&value=all start times, could you give us more details why you are increasing to to every 3 hours rather than 6?
 
@fln No i mean:

Code:
10 0 * * * root echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue

I'd like to increase how many times the stats for all users are updated. In the previous docs this was mentioned that you could change this cron line. And I see now that it is reset on all servers to the default 10 0 * * *, which is a bit annoying.

And I see now that it is indeed only updated once;

Last Tally Completion5-4-2022 00:10:03

Is this not possible anymore?
 
Cron script will get restored on each update until we come up with solution for this :) issue. It is not set in stone but we need to collect some details before rushing to a decision.

@jamgames2 I understand that you would like to change cron file settings, but I am more interested in the real reason, why would one want to execute tasks every 30 seconds? Or in @Erulezz case why would one want stats to be collected more often?

If we get to the root cause of all the changes we could properly fix it for everyone rather than leave it configurable. For example adding ionice for dataskq could be something configurable in directadmin.conf, rather than manually editing cron script.

If we allow cron script to be configurable it becomes tricky for us to make changes in the cron script (like changing repeating task intevals, adding and removing them). Customization of cron script might be so heavy that it no longer has anything in common with the default cron script.
 
Starting DA version 1.63.7 file /etc/cron.d/directadmin_cron is always replaced on DA update meaning any local modifications would get overwritten after update.

Key reason was eliminating the periodic license refresh call to getLicense.sh (which is no longer necessary in the latest DA versions). But we also think there should be no need to customize this file. And in the future we plan to move dataskq execution from cron into the directadmin service. We expected execution times in the standard cron script were good enough for everyone.

It would be great to better understand the reasons, why one would like to change it. @rlahaise could you give us more details why would you like to change the action=tally&value=all execution time? @Erulezz you are referring to customized action=vacation&value=all start times, could you give us more details why you are increasing to to every 3 hours rather than 6?

My reason for changing this file is because of performance issues, I have seen that a combination of backups, other intensive cron jobs and the tally=all can be a bit too much at the same time.

So it would be nice to be able to customize this as well but I do understand that there won't be that many people that actually need to change this.

PS. I wouldn't mind seeing the cron jobs replaced with systemd-timers, but that is just my preference, I know many people still dislike systemd! :D
 
  • Like
Reactions: fln
? thanks @Erulezz. I think in this situation it would be best to have a config option in directadmin.conf that controls the number of times per day to run tally.

It would help everyone to choose between accuracy and resource usage. As a temporary solution until we fix this making tally to run more often can be achieved by creating a new file in cron.d with a different name.

@rlahaise thanks for the details. Any additional real use-cases would be really appreciated.
 
Task every 30 second use for Brute force monitor, 1Miniute is too slow. Somecase I need run quickly more than 1minute. Slow running may cause attacker scanning some website that use wordpress more often.
And other application that protected by BFM.

I know, CSF Firewall can protect other application, but sometime BFM better than this.
 
Starting DA version 1.63.7 file /etc/cron.d/directadmin_cron is always replaced on DA update meaning any local modifications would get overwritten after update.
But we also think there should be no need to customize this file.
Can these changes be mentioned in future changelogs, even if they are minor internal changes that still can "effect" users? It was possible before, and even described in the docs that you can edit this file.
I think in this situation it would be best to have a config option in directadmin.conf that controls the number of times per day to run tally.
That would be a great option to have.(y)
 
Noted. We will take care to document breaking changes more thoroughly. In this particular case I have add a note about this change.

Running dataskq more often can be achieved by creating new cron job file. Docs are updated to reflect that.

Our long term plan is to actually start executing required tasks directly from the directadmin service. That way we could fine tune each task frequency in a more fine grained way. This would allow us for example:
  • Run BFM actions more than once a minute while running normal tasks once a minute.
  • Have configurable tally period interval, default 24h, but configurable to any other value.
  • Separate backups (and other long running tasks) to run in separate process not blocking short periodic tasks.
  • Introduce separate timers easily without updates to cron file.
Since it is not something we will have in next release, I have updated the docs, but we will still keep replacing main directadmin cron_job file for each update, to allow us to remove tasks from there that we moved inside the main directadmin service. Please keep all modifications in custom file for the time being ?‍♂️. Thank you all for the feedback.
 
Back
Top