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