Re: cron directory temporaries

/dev/rob0 <[email protected]>
Newsgroups gmane.linux.slackware
Organization RTFM
Message-ID <[email protected]>
On Sun, Nov 25, 2012 at 11:49:45AM +1000, Nick Edwards wrote:
> Does anyone know why /var/spool/cron is full of temporary 
> directories, shouldn't crontab remove them once it puts the
> new crontab in place?

Apparently it does not.

> The directories are actually empty, and the only user on the
> server is root, so surely it can't  be a permissions issue

FWIW I don't recommend this. Even if I am the only one logging in, 
I'll login to a non-root account and use su/sudo when higher 
privileges are needed.

> eg:
> 
> drwxr-xr-x  2 root root  4096 Jul 31 20:55 cron.AoUk2o/
> 
> Any suggestions muchly appreciated.

1. Look in the crond(8) manual.
2. Look in the crontab(1) manual.

I did both of those. I did not see mention of these directories. 
Maybe I missed it.

3. Experiment.

I did that also. I ran crontab -e (as a NON-root user of course) and 
found that a new mode 600 directory owned by that user was created 
under /var/spool/cron/ . When I saved the new crontab the directory 
was renamed (was crontab.AL6dpA and changed to cron.PnvHYt) and chown 
root:root mode 755.

Hmm, a mode 600 directory cannot be entered. I've never seen that. I 
didn't take the time to watch everything that happened in that 
directory during the crontab process. You might find strace(1) of 
interest if you want to do this.

My conclusion: it's sloppy and could be considered a bug. So the 
final suggestion, choose one of these:

4a. Report the issue to the project (I would not call it "bug" at 
first.)
4b. Dig in the code, find where and why this happens. Offer a patch 
to the project if you can and if appropriate.
4c. Make a simple cron.daily job to delete empty directories named 
/var/spool/cron/cron.* and root:root mode 755. See what breaks, if 
anything. :)
4d. Don't worry about it.

My choice: the last one.
-- 
  http://rob0.nodns4.us/ -- system administration and consulting
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.