Linux – formatting of cron.allow and/or does cron need to be restarted

crondebianlinux

I'm trying to setup a crontab specifically for the user that runs the web process. I have root/sudo access so I wrote an entry for the www-data user using the -e option and here is the listing using the -l option:

/etc$ sudo crontab -u www-data -l
# m h  dom mon dow   command
15,30,45 * * * * /var/www/cron/test.cli.php

The process is not running at the appointed interval however. I'm pretty sure I have the syntax correct so this leads me to a few other possibilities

1) improperly formatted /etc/cron.allow? I actually created this as sudo/root and all I've done is enter a line with "www-data" on it. However, is this the correct format? I'm having a hard time finding information on how /etc/cron.allow should be formatted, its not in the man as far as I can tell (http://linux.die.net/man/1/crontab)

2) Is /etc the correct location for cron.allow on Debian? I googled and it mentions that it might go elsewhere under SUSE but all indications unless I'm mistaken is that under Debian /etc is the correct location.

3) Permissions for /etc/cron.allow? I (temporarily) set them to 777, could this be too permissive?

4) Does cron need to be restarted after the creation/modification of cron.allow (or cron.deny)?

PS….since first posting this on stackoverflow (where I will now delete it) I have tried restarting cron to no avail: the task still does not run

Best Answer

As Cornfed said, your .php script would have to start with #!/usr/bin/php for that to work.

1) The cron.allow/deny files only affect a users ability to run the 'crontab' command, not the ability for a user to have a crontab. See man crontab.

2) Yes, also listed in man crontab.

3) Yes, any user could add themselves to that list. That's way too permissive. But in most cases you do not need this file on Debian. From man crontab: "For standard Debian systems, all users may use this command."

4) No, but I have noticed a delay in acceptance of new commands. See /var/log/daemon (I think) for CRON's updating of it's internal files.