virtualmin / virtualmin-gpl

Virtualmin web hosting control panel for Webmin
https://www.virtualmin.com
GNU General Public License v3.0
316 stars 98 forks source link

Request: improved syntax for cronjob creation timing #223

Open ChristopherW opened 3 years ago

ChristopherW commented 3 years ago

I scheduled a cronjob using the Webmin creator and while simple to use, it produces syntax more complicated than necessary. For example, to replace triggered wp-cron loads with a cronjob which runs every 5 minutes, the scheduling syntax it generates is

0,5,10,15,20,25,30,35,40,45,50,55 * * * * wget -q -O - https://site/wp-cron.php?doing_wp_cron >/dev/null 2>&1 When it could just be */5 * * * * wget -q -O - https://site/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Perhaps something like a text box for each unit of time, with radio buttons to specify you either want to input a range or an "every x" interval?

Sidenote, I keep referring to https://crontab.guru/ for this stuff, my brain deletes cron syntax too quickly, and it shows a few other possibilities too plus a nice calculated human-readable result.

Incidentally I opened the Edit Cron Job page, manually updated the schedule syntax of a cron, saved the crontab, then clicked Return to Module Index in Webmin... Miniserv then stalled out and I had to service webmin restart to get it back. Perhaps coincidental, but I wondered if perhaps changing the cron while viewing it was causing some problem when requesting the list of cronjobs again.

jcameron commented 3 years ago

This is true, but also kind of hard to fix - we convert cron specs like */5 into a selection of minutes to keep the UI simple, but converting back just based on a list of minutes chosen is a little trickier. I suppose what we could do is offer a separate UI option for just "every X minutes", but not allow it to be combined with hourly or daily selections.