Multiple crontabs?

Is it possible to have multiple crontabs?

I tried creating a second file with 0644 permission is /etc/crontabs but it said the file is ignored because no user exists with that name.

Makes sense, doesn't it?
Why do you need a second crontab?

In a way yeah, but why not just execute everything in the crontabs directory just like it does for rc.d? I have my own root crontab, but OpenWISP is replacing mine, so I might have to just change that script so it appends it to the root crontab instead of replacing the file.

If there isn't such a user, OpenWrt won't know under which user's credentials to run the command.
One solution would be to create another user.
The other to raise a ticket with OpenWisp for a solution.

Is there any way to do it with symbolic links, like replace /etc/crontabs/root with a soft link that points to two other files?

you want a single script that "runs-a-dir" aka hourly weekly etc., run it every 10mins or hour and have it return when the times don't match etc.

As far as I know you can have a symbolic link to one file.
But if you know when the OpenWisp messes with the crontab (e.g at restart of a service) you could add a small script to append the contents of your crontab to the OpenWisp modified root contab.

I suggest raising the issue in OpenWISP project https://github.com/openwisp as just replacing the crontab file with their own is brutal even for a shell script application (and their stuff is in python so it should be able to parse it fine), they should just append or edit only their own cron jobs.

1 Like

To be fair, it's not the fault of the OpenWISP project, it's just that a specific template I have that happens to be replacing this file. We just need to refine this template so it does not destructively replace this file.

There was an OpenWISP template which defined the crontab, it was just a matter of updating the template (I had a chat with @biangbiangmian).