As indicated by the directory names, periodic is launched on a daily, weekly, and
monthly basis. See man periodic for more details.
The shell script
I had recently installed a www interface to a mailing list
archive and now I wanted to automagically update the files instead of manually running
the batch job every day.
The first step was to create a shell script which did what I
wanted. Here is the contents of /etc/periodic/daily/470.hypermail-adsl:
After testing the above script on Monday night to ensure it ran and did what I wanted,
I left my box and went to bed, secure in the knowledge that the archives would be updated
as I slept. I was wrong. The next morning the archives were untouched.
I had no idea why. But checking the file permissions I think I found out why:
-rw-r--r-- 1 root wheel 272 Nov 8 22:31 470.hypermail-adsl
As you can see, the executable bit has not been turned on. Oh well, that's easy
to fix:
chmod 755 470.hypermail-adsl
Now the file looks like this:
-rwxr-xr-x 1 root wheel 272 Nov 8 22:31 470.hypermail-adsl
Here's hoping that it runs properly tonight.
GOTCHA! (part 2) - Wednesday
It didn't run again. Hmmm. I asked on IRC for some clues. They
suggested path. Of course! I even remember it in the man pages. I can't
use plain old hypermail; I have to include the path. Here is the newly
amended script:
Now I'm not so sure about the changes I made earlier regarding the executable bit.
But at least the files are now all of the same flag setting. Here's hoping
for tonight!
Finally
The shell script ran last night. I'm pleased. Here's what I found in my
"daily run output" mail message:
Security check:
(output mailed separately)
Checking for rejected mail hosts:
2 p21-adsl.wn.paradise.net.nz
Loading mailbox
"/usr/local/majordomo/lists/adsl.archive/adsl.archive.9911"...
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160
170 180
183 articles.
Writing articles to "/usr/local/www/data/freebsddiary/adsl/1999_11"...
0% 3% 5% 8% 11% 14% 16% 19% 22% 25% 27% 30% 33% 36% 38% 41%
44% 47% 49% 52% 55% 58% 60% 63% 66% 69% 71% 74% 77% 80% 82% 85%
88% 91% 93% 96% 99%
Writing date index to
"/usr/local/www/data/freebsddiary/adsl/1999_11/date.html"...
Writing thread index to
"/usr/local/www/data/freebsddiary/adsl/1999_11/index.html"...
Writing subject index to
"/usr/local/www/data/freebsddiary/adsl/1999_11/subject.html"...
Writing author index to
"/usr/local/www/data/freebsddiary/adsl/1999_11/author.html"...
And this is what was at the bottom of the html page in question:
This archive was generated by hypermail 2.0b3 on
Thu 11 Nov 1999 - 02:31:13 NZDT
This script is working just fine. But I'll monitor it closely by examining using
the daily run mail message.