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