5 ms·
Frustrating Unix pitfall of the day: esoteric cron rules This isn't a Unix pitfall, it's a Debian pitfall. Further, it's not inherent to cron, but to the /etc
by js2 15y ago
Frustrating Unix pitfall of the day: esoteric cron rules
This isn't a Unix pitfall, it's a Debian pitfall. Further, it's not inherent to cron, but to the /etc/cron.{hourly,daily,weekly,monthly} concept as implemented by Debian.
Scripts in these directories are run via /usr/bin/run-parts, which is invoked via /etc/crontab. It is Debian's run-parts that imposes the naming restriction. Red Hat's run-parts doesn't have this restriction (go take a look, it's a shell script).
- tedunangst 15y agoThank you for that clarification. I've been running shell scripts named .sh all the time without trouble. Of course, I run them from crontab. I'd never even heard of this /etc/cron.* thing.
- sliverstorm 15y agoIt's somewhat nifty, I suspect it originated as a way to allow new packages to easily add jobs to cron if they need
- gwern 15y agoThat's what Krafft says in _The Debian System_, actually - that it would be a real mess if new packages all had to edit the same crontab to install and deinstall themselves, but a directory-based system was very clean.
- hollerith 15y ago>This isn't a Unix pitfall, it's a Debian pitfall. And that is an example of why I do not run Debian any more: (1) it assumes that I have nothing better to do than learn all of the details of the Debian system and (2) as soon as some complication like this dots-in-filenames thing makes it into stable, it is very difficult to remove because most Debian maintainers consider it-might-break-existing-code a winning argument.
- ramidarigaz 15y agoWhat do you use instead?
- maratd 15y agoCentOS/Redhat or you could go full Unix with FreeBSD. Lots of other options too.
- Nick_C 15y agoSlackware. As usual, takes the good bits out of both RedHat's and Debian's run-parts. It allows .{whatever} but ignores obvious, well-known suffixes like .bak etc. From man run-parts: run-parts automatically skips files with certain suffixes that are generally associated with backup or extra files. Any file that ends in one of these will be silently ignored: ~ ^ , .bak .new .rpmsave, .rpmorig .rpmnew .swp
- hollerith 15y agoI was a Linux user since 1997, but switched to OS X in 2009.
- hollerith 15y agoI switched to OS X in 2009. At the point I had been running Linux for 12 years, and GNU and Emacs on proprietary Unix for the 5 years before that.
- pyre 15y agoOn the other hand, CentOS 5 has run-parts, but it doesn't have a --help option or a manpage. The Debian one does.
- deleted 15y ago[deleted]
- barrkel 15y ago"It might break existing code" is usually a winning argument. It takes a very strong opposing argument to beat it. If you don't believe in this, I don't want to use any of your code.
- raldi 15y agoHey, when you only get 80 characters for the headline, certain things have to be glossed over.