run-parts

Debian has some handy directories for dropping scripts into regular cron rotation, /etc/cron.hourly/, /etc/cron.daily/, /etc/cron.weekly/ and /etc/cron.monthly/.

I spent a long time wondering (but never really looking) into why certain update scripts I had in there weren’t running. Turns out these scripts are called via “run-parts”, and, well, turns out it’s my stupid fault for not reading the manpage, which makes it pretty clear:

RUN-PARTS(8):

run-parts runs a number of scripts or programs found in a
single directory directory. Filenames should consist
entirely of upper and lower case letters, digits, underĀ­
scores, and hyphens. Subdirectories of directory and
files with other names will be silently ignored.

My script’s name? “check-apt.sh”, which puts it into the “silently ignored” category. Lesson learned — always read the man pages, kids.

Tags: Linux/BSD

2 Responses to “run-parts”

Comments

  1. Comment by Atlantis

    I had the exact same problem running on Fedora Core 2. I spent hours researching the issue and found that you can test the files in the folders by entrering:

    run-parts /etc/cron.hourly

    When I did this, I got the following message:
    “: bad interpreter: No such file or directory: /bin/sh”

    I knew that the first line of my script named “check_mail.cron”, which was located in the /etc/cron.hourly folder, was “#!/bin/sh”. I removed this line from my script and then cron (or run-parts) was able to process it without any problem.

Trackbacks/Pingbacks

  1. [...] e notification script Filed under: Linux/BSD — Chris @ 9:26 pm I realized I mentioned this script previously, but never got around to actually posting it. This is a hand [...]

Leave a Reply