1 |
On 12/11/2012 04:15 PM, Grant wrote: |
2 |
> Is there a way to remove "Cron <root@hostname>" from the subject line of |
3 |
> crontab mail without piping each cron job to 'mail'? |
4 |
> |
5 |
> I set 'usermod -c hostname root' on each of my systems so that the From: |
6 |
> line displays "hostname" for crontab mail. This works on each system |
7 |
> except the mail server itself which still shows "Cron Daemon". Can |
8 |
> crontab mail from the mail server be made to display From: "hostname" |
9 |
> like the other systems? |
10 |
> |
11 |
> I'm not completely clear on how cronbase works. Can this crontab be |
12 |
> integrated into the system crontab via cronbase or should it be run as a |
13 |
> separate user crontab for root? |
14 |
> |
15 |
> 0 4 * * * layman -NS && eix-sync -n && eix-remote update -n |
16 |
> 15 4 * * * emerge -pvDuN world |
17 |
> 20 4 * * * eclean -C distfiles |
18 |
> 30 4 * * * eclean -C packages |
19 |
> 40 4 * * * eix-test-obsolete |
20 |
> 45 4 * * * revdep-rebuild -ip |
21 |
> |
22 |
|
23 |
If your goal is to run these each one after the other, you can simply |
24 |
stick a shell script in /etc/cron.daily that executes them in order. |
25 |
|
26 |
The default crontab runs any executable files in, |
27 |
|
28 |
* /etc/cron.daily |
29 |
* /etc/cron.hourly |
30 |
* /etc/cron.monthly |
31 |
* /etc/cron.weekly |
32 |
|
33 |
at roughly the time specified in /etc/crontab. If any of those |
34 |
directories contain scripts, they're run in "alphabetical" order, i.e. |
35 |
how `ls` would sort them. |
36 |
|
37 |
To fix the Subject/From headers, try, |
38 |
|
39 |
http://www.postfix.org/header_checks.5.html |
40 |
|
41 |
I've never had to use them myself, but I think the REPLACE action will |
42 |
do what you want. The alternative is to replace the sendmail binary with |
43 |
something that executes e.g., |
44 |
|
45 |
sed -e 's/Subject: Cron <[^>]> /Subject: /g' | /the/actual/sendmail |
46 |
|
47 |
Both feel a little dirty, but the header checks are less likely to break |
48 |
something assuming that they will work on a client-provided From header. |