Cron job settings are very unintuitive. Docs need updating

SYSTEM INFORMATION
OS type and version no idea
Virtualmin version latest

This should spell it out for us with screenshots: How to setup a cron job – Virtualmin and there should probably be a help link (possibly linking to that page) under :10000/cron/?xnavigation=1

This is somewhat helpful, but doesn’t answer/solve my issue: Scheduled Cron Jobs | Webmin

The problem: webmin cron not running per minute

A commenter there identifies the problem:

on the picture it seems you set it to run every first minute in every hour (not every minute)

When I read the comment I looked back carefully at the image and thought “no, that’s wrong”, and dismissed that thread. Later when I read in some random discussion (after looking through dozens of search results) how to check the logs (/var/log/syslog or webmin → system → system logs viewer), I saw that the commenter is correct.

But I still can’t figure out what the right setting should be. I tried putting “0” for hour since that seems to be the only other reasonable option, yet that didn’t work either.

It doesn’t seem to only be me. This guy knows this stuff very well and opts for command line usage instead: https://vpsfix.com/5920/install-sendy-vps-virtualmin-nginx/ - I don’t know what command line he’s talking about though.


EDIT:
Oh my. To get it to run every 5 minutes we probably have to ctrl+click “5, 10, 15, etc.” under the “minutes” section. Geez. No wonder that guy felt it is tedious.

Possible fixes:

  • As mentioned above, provide some help text/link.
  • Allow us to paste in the raw code:
    */5 * * * * php /home/AdminUser/public_html/scheduled.php > /dev/null 2>&1

Or maybe that’s what “Input to command” does? There should really be some help tooltips.

@user20,

If you want the cron to run “every minute”, “every hour”, “every day”, “every month”, “every weekday”, you would set…

Minutes: All
Hours: All
Days: All
Months: All
Weekdays: All

In the screenshot you referenced, you had “Selected” and “1” for the “Minutes” which means it’d run:

Every Weekday
Every Month
Every Day
Every Hour
At 1 min into the hour

One adjustment would fix it if I understand you required results correctly.

1 Like

That’s probably not a bad idea. Although if you know how to write a cron expression, then maybe just open a terminal and run crontab -e.

But then again, maybe a user account doesn’t have shell access. Or maybe the user is copying and pasting and doesn’t fully understand what they’re doing.

In either case, being able to paste the expression (or the whole command), with a confirmation screen that interprets the command for the user and asks them to confirm that that’s what they really want to happen, might indeed be a usability improvement.

Richard

Another point regarding “terminal vs pasting in raw code” - I did open what I thought to be a terminal into my virtualmin instance (using that person’s directions) but it still said I had no existing file/crons:

Since you’re opening crontab for the first time, you will be asked to select an editor. Select nano text editor as it’s the easiest to use from the bunch.

Even though I had already set some up via the UI. So that confused me further, and I didn’t continue with the commands.

It says “/tmp/crontab.B6U5jQ/crontab” at the top, and I couldn’t find that in the virtualmin file manager.

As the file location suggests it is a temporary file so you will never find it as it is removed when crontab closes . Post up the contents of your crontab so we can see what is going on

I solved my original issue in the EDIT of the OP. I was just adding some more insight from a “completely noob” perspective.

didn’t this work ? see green arrows

Yes, that works for “every minute”, but I also needed every 5 and 15 minutes. Which I did figure out how to do eventually.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.