diff options
Diffstat (limited to 'oftc-listmod-learn-mail')
-rwxr-xr-x | oftc-listmod-learn-mail | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/oftc-listmod-learn-mail b/oftc-listmod-learn-mail index 6f758af..6c218ee 100755 --- a/oftc-listmod-learn-mail +++ b/oftc-listmod-learn-mail @@ -5,6 +5,9 @@ SPAMOUT="mail/spam-learned" HAMIN="mail/ham-learn" HAMOUT="mail/ham-learned" +#PREFIX = "sudo -H -u amavis " +PREFIX = "" + $verbose = 0 if ARGV[0] == "-v" $verbose = 1 @@ -33,8 +36,8 @@ check_maildir HAMOUT Dir[SPAMIN+"/new/*"].each do |filename| puts "learning #{filename}" if $verbose > 0 - if system("sudo -H -u amavis sa-learn --spam < #{filename} > /dev/null") - if system("sudo -H -u amavis bogofilter --register-spam < #{filename} > /dev/null") + if system("#{PREFIX}sa-learn --spam < #{filename} > /dev/null") + if system("#{PREFIX}bogofilter --register-spam < #{filename} > /dev/null") puts "moving #{filename}" if $verbose > 0 move(filename, SPAMOUT) else @@ -46,8 +49,8 @@ Dir[SPAMIN+"/new/*"].each do |filename| end Dir[HAMIN+"/new/*"].each do |filename| puts "learning #{filename}" if $verbose > 0 - if system("sudo -H -u amavis sa-learn --ham < #{filename} > /dev/null") - if system("sudo -H -u amavis bogofilter --register-ham < #{filename} > /dev/null") + if system("#{PREFIX}sa-learn --ham < #{filename} > /dev/null") + if system("#{PREFIX}bogofilter --register-ham < #{filename} > /dev/null") puts "moving #{filename}" if $verbose > 0 move(filename, HAMOUT) else |