#!/usr/local/bin/perl
# apply.cgi
# Send a HUP signal to spamassassin-related processes

require './spam-lib.pl';
&error_setup($text{'apply_err'});
if ($config{'restart_cmd'}) {
	$out = &backquote_logged("$config{'restart_cmd'} 2>&1 </dev/null");
	if ($? || $out =~ /error|failed/i) {
		&error("<pre>$out</pre>");
		}
	}
else {
	@pids = &get_process_pids();
	@pids || &error($text{'apply_none'});
	foreach $p (@pids) {
		&kill_logged("HUP", $p->[0]);
		}
	}
&webmin_log("apply");
&redirect("");

