> Could future versions of sa-update please be a little more vocal? > > Like maybe "no new updates found | loaded xxx new updates | error xxx" > > Exit codes are not evident when simply typing sa-update on the command > line...
I created my own simple batch file for windows. It runs sa-update. Checks the return code. Creates a message (some/no updates). GREP's some basic info from the debug output so you can tell what got updated. And using a perl script, sends the message, report, and debug output to me in e-mail every morning. All this would be easy to do on any OS, I presume since I didn't use any windows-specific tools except for the batch language itself. Here's what the batch file looks like (watch the line wrapping): call sa-update --channelfile sa-update-channels.txt --gpgkey 856AA88A -D 1>sa-update-out.txt 2>sa-update-dbg.txt if errorlevel 1 goto noupd echo Some rules updated.>sa-update-msg.txt goto makelog :noupd echo No updates available.>sa-update-msg.txt :makelog echo.>>sa-update-msg.txt echo Log files attached.>>sa-update-msg.txt c:\bat\grep -F -f sa-update-grep.txt sa-update-dbg.txt >sa-update-log.txt perl sa-update-send.pl<sa-update-msg.txt ----- And here's the perl script to send the e-mail: # E-mail notification settings. The download/version log is sent plus # if auto updating, the SA lint stdout and stderr are sent. # E-mail is only sent if there is a newer version of at least one rule file. # Set $mail_host to '' for no notification. my $from_address = '[EMAIL PROTECTED]'; my $to_address = '[EMAIL PROTECTED]'; my $mail_host = 'mail.wcg.org'; my $subject = 'SpamAssassin Rule Updates'; use MIME::Lite; use NET::SMTP; my $message_body = ""; while (<>) { $message_body .= $_ } if ($mail_host) { # Notify admins $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating message: $!\n"; $msg->attach ( Type => 'TEXT', Data => $message_body ) or die "Error adding the text message part: $!\n"; $msg->attach ( Type => 'text/plain', Path => "sa-update-log.txt", Filename => "sa-update-log.txt", Disposition => 'attachment' ) or die "Error adding sa-update-log.txt: $!\n"; $msg->attach ( Type => 'text/plain', Path => "sa-update-dbg.txt", Filename => "sa-update-dbg.txt", Disposition => 'attachment' ) or die "Error adding sa-update-dbg.txt: $!\n"; $msg->attach ( Type => 'text/plain', Path => "sa-update-out.txt", Filename => "sa-update-out.txt", Disposition => 'attachment' ) or die "Error adding sa-update-out.txt: $!\n"; MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send; } ----- HTH, Bret