Cron.daily scripts that don't run on Ubuntu

By John Bowen, 9 November, 2008

I found a really nice script that backs up all my MySql databases on a rotation, and generally provides insurance against database crashes and the like. I followed the instructions given, popping my copy of the script into /etc/cron.daily, and double-checking the permissions. The only change I had to make to get the script to run properly was to set #!/bin/sh at the beginning of the file...after that, I could run it *manually* all I wanted. Neato.

But, I found after the first night that autocron wasn't running my new script (at least, I wasn't getting the email notification about how the backup went). So I went digging around and found this article, where the author mentions he had the same problem and _may_ have found a solution in removing all the '.'s from script names in cron.daily.

I took a quick look inside cron.daily, but besides my own new script (automysqlbackup.sh), there are 5 others that have dots in their names...presumably, they were put there by a package/tool...they can't be wrong...right?

A little more digging turned up a suggestion to run "ls -lut" in the /etc/cron.daily folder, essentially listing the scripts by their last run time. Check this out:

[inline:screenshot_1.png]

My script has been renamed already in this screenshot, but you can clearly see that the scripts with a dot in their name haven't been run in a long time (probably not since they were created).

I'll try to post back tomorrow with results, but it sure looks like that advice was right on...*scripts in cron.daily (on Ubuntu) won't run unless there is no dot (".") in their name*.

[update:2008-11-25]
This has worked perfectly since making these changes!
[/update]

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.