2015-08-05 04:58:16 |
quanta |
bug |
|
|
added bug |
2015-08-05 05:01:12 |
quanta |
description |
- Ubuntu 14.04.2 LTS
- amavisd-new 1:2.7.1-2ubuntu3
The contents of `/usr/sbin/amavisd-new-cronjob` file:
```
if ! perl -MMail::SpamAssassin -e "my \$spamtest = Mail::SpamAssassin->new();
\$spamtest->compile_now (); \$spamtest->{conf}->{use_bayes} ? exit 0 : exit 1"
then
#bayes is disabled - just exit
exit
fi
case $1 in
sa-sync)
/usr/bin/sa-learn --sync 2>&1 >/dev/null
;;
sa-clean)
/usr/bin/sa-learn --sync --force-expire 2>&1 >/dev/null
;;
*)
echo "$0: unknown cron routine $1" >&2
exit 1
;;
esac
```
There are 2 problems here:
1. It throws a stderr message at the first time running:
```
bash -x /usr/sbin/amavisd-new-cronjob sa-sync
+ test -e /usr/bin/sa-learn
+ test -e /usr/sbin/amavisd-new
++ id --name -u
+ '[' amavis '!=' amavis ']'
+ set -e
+ umask 022
+ perl -MMail::SpamAssassin -e 'my $spamtest = Mail::SpamAssassin->new();
$spamtest->compile_now (); $spamtest->{conf}->{use_bayes} ? exit 0 : exit 1'
config: created user preferences file: /var/lib/amavis/.spamassassin/user_prefs
+ case $1 in
+ /usr/bin/sa-learn --sync
+ exit 0
```
This should be silent as it's run in a cron job.
2. To redirect both stdout and stderr to /dev/null, the redirection order should `>/dev/null 2>&1` instead of `2>&1 >/dev/null` (this one just redirects stdout). |
- Ubuntu 14.04.2 LTS
- amavisd-new 1:2.7.1-2ubuntu3
/etc/cron.d/amavisd-new
```
#
# SpamAssassin maintenance for amavisd-new
#
# m h dom mon dow user command
18 */3 * * * amavis test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-sync
24 1 * * * amavis test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-clean
```
The contents of `/usr/sbin/amavisd-new-cronjob` file:
```
if ! perl -MMail::SpamAssassin -e "my \$spamtest = Mail::SpamAssassin->new();
\$spamtest->compile_now (); \$spamtest->{conf}->{use_bayes} ? exit 0 : exit 1"
then
#bayes is disabled - just exit
exit
fi
case $1 in
sa-sync)
/usr/bin/sa-learn --sync 2>&1 >/dev/null
;;
sa-clean)
/usr/bin/sa-learn --sync --force-expire 2>&1 >/dev/null
;;
*)
echo "$0: unknown cron routine $1" >&2
exit 1
;;
esac
```
There are 2 problems here:
1. It throws a stderr message at the first time running:
```
bash -x /usr/sbin/amavisd-new-cronjob sa-sync
+ test -e /usr/bin/sa-learn
+ test -e /usr/sbin/amavisd-new
++ id --name -u
+ '[' amavis '!=' amavis ']'
+ set -e
+ umask 022
+ perl -MMail::SpamAssassin -e 'my $spamtest = Mail::SpamAssassin->new();
$spamtest->compile_now (); $spamtest->{conf}->{use_bayes} ? exit 0 : exit 1'
config: created user preferences file: /var/lib/amavis/.spamassassin/user_prefs
+ case $1 in
+ /usr/bin/sa-learn --sync
+ exit 0
```
This should be silent as it's run in a cron job.
2. To redirect both stdout and stderr to /dev/null, the redirection order should `>/dev/null 2>&1` instead of `2>&1 >/dev/null` (this one just redirects stdout). |
|
2015-08-05 05:03:58 |
Diep Pham |
bug |
|
|
added subscriber Diep Pham |
2015-08-06 22:58:14 |
Robie Basak |
bug |
|
|
added subscriber Ubuntu Server Team |
2021-09-22 19:23:41 |
Sergio Durigan Junior |
amavisd-new (Ubuntu): assignee |
|
Sergio Durigan Junior (sergiodj) |
|
2021-09-22 19:23:46 |
Sergio Durigan Junior |
amavisd-new (Ubuntu): importance |
Undecided |
Low |
|
2021-09-22 19:23:48 |
Sergio Durigan Junior |
amavisd-new (Ubuntu): status |
New |
In Progress |
|
2022-02-18 22:03:02 |
Launchpad Janitor |
amavisd-new (Ubuntu): status |
In Progress |
Fix Released |
|