Crontab: errors in crontab file, can't install

Hi there,

After last night’s shenanigans with VNET failing, I continued on with setting up my Nextcloud server. All was working fine, created an ncadmin account and connected it to my database, but now I’ve ran into an error with Cron(tab).

Upon attempting to configure cron for the www user and add an entry to run the Nextcloud cron script, I’m faced with the following error:

crontab: installing new crontab
“/tmp/crontab.DSutHVOEvt”:7: bad minute
crontab: errors in crontab file, can’t install
Do you want to retry the same edit?

I’ve tried copying and pasting the Crontab header (from Squarism) and retyping out the directory countless times and I can’t find anything online, other than a forum thread that looks promising, but is just asking about configuring a service. I’m kinda stumped here and I’m not sure what I need to do. Any help is appreciated

Cheers in advance

Well, I think the error message says it clear: you have an error with your crontab-setup, probably with the minutes. You should post your crontab-entry.

My bad, this is the entry I’m trying to use:

# minute (0-59),
# |     hour (0-23),
# |     |       day of the month (1-31),
# |     |       |       month of the year (1-12),
# |     |       |       |       day of the week (0-6 with 0=Sunday).
# |     |       |       |       |       commands
  */15      *       *       *       *       /usr/local/bin/php -f /usr/local/www/nextcloud/cron.php

Try

# minute (0-59),
# |     hour (0-23),
# |     |       day of the month (1-31),
# |     |       |       month of the year (1-12),
# |     |       |       |       day of the week (0-6 with 0=Sunday).
# |     |       |       |       |       commands
  15      *       *       *       *       /usr/local/bin/php -f /usr/local/www/nextcloud/cron.php

Just tried that and still receiving the same error of: crontab: errors in crontab file, can’t install

Post the exact message.

It’s the exact same message that’s stated in the description of the thread, hence why I just shortened it in my previous reply

Try

# minute (0-59),
# |     hour (0-23),
# |     |       day of the month (1-31),
# |     |       |       month of the year (1-12),
# |     |       |       |       day of the week (0-6 with 0=Sunday).
# |     |       |       |       |       commands
# 15      *       *       *       *       /usr/local/bin/php -f /usr/local/www/nextcloud/cron.php

and post the result. It should be something like: crontab: installing new crontab

crontab: installing new crontab
“/tmp/crontab.H3u7EY9TDF”:7: bad minute
crontab: errors in crontab file, can’t install
Do you want to retry the same edit?

I could reproduce your error. You have to delete the whole line and then save your crontab. Now it should do it without error. Then you have to add the line again:
15 * * * * /usr/local/bin/php -f /usr/local/www/nextcloud/cron.php

Do not copy it but write it.
Then save your crontab again, now hopefully without error.
The main problem is, you have first to save your crontab without error, even if it is empty but for the leading comments. Once saved without error you can modify it again.

1 Like

That’s perfect, it’s finally working :smiley:. So would the error be produced due to white space?

I don’t think so, white spaces are no problem for the crontab. But probably there where some non-printable characters or a Windows EndOfLine or something like that …