local $SIG{PIPE} = 'IGNORE';
- if (!(syswrite($sock, "PASSWORD $self->{password}$EOL"))) {
+ if (!(syswrite($sock, "password $self->{password}$EOL"))) {
$self->_mark_dead($remote);
return 0;
}
my ($is_ctrl) = @_;
if (! open CONF, "< $cfg{'conf_file'}") {
- print "Config file $cfg{'conf_file'} cannot be opened\n";
+ print STDERR "Config file $cfg{'conf_file'} cannot be opened\n";
return;
}
my $cmd = shift;
my @path = shift;
-my $do_parse_config = 1;
if (!defined ($cmd) || $cmd eq '') {
$cmd = 'SYMBOLS';
if (defined ($args{c})) {
if (-r $args{c}) {
$cfg{'conf_file'} = $args{c};
- $do_parse_config = 1;
}
else {
die "config file $args{c} is not readable";
}
}
+
+if ($cmd =~ /(SYMBOLS|PROCESS|CHECK|URLS|EMAILS)/i) {
+ $cfg{'command'} = $1;
+ $cfg{'control'} = 0;
+}
+elsif ($cmd =~ /(STAT|LEARN|SHUTDOWN|RELOAD|UPTIME|COUNTERS|FUZZY_ADD|FUZZY_DEL|WEIGHTS)/i) {
+ $cfg{'command'} = $1;
+ $cfg{'control'} = 1;
+}
+else {
+ die "unknown command $cmd";
+}
+
+if (-r $cfg{'conf_file'}) {
+ # Try to parse config
+ parse_config ($cfg{'control'});
+}
+
if (defined ($args{S})) {
$cfg{'imap_search'} = $args{S};
}
$cfg{'ip'} = $args{i};
}
-if ($cmd =~ /(SYMBOLS|PROCESS|CHECK|URLS|EMAILS)/i) {
- $cfg{'command'} = $1;
- $cfg{'control'} = 0;
-}
-elsif ($cmd =~ /(STAT|LEARN|SHUTDOWN|RELOAD|UPTIME|COUNTERS|FUZZY_ADD|FUZZY_DEL|WEIGHTS)/i) {
- $cfg{'command'} = $1;
- $cfg{'control'} = 1;
-}
-else {
- die "unknown command $cmd";
-}
-
if ($cmd =~ /SYMBOLS|SCAN|PROCESS|CHECK|REPORT_IFSPAM|REPORT|URLS|EMAILS|LEARN|FUZZY_ADD|FUZZY_DEL|WEIGHTS/i) {
$cfg{'require_input'} = 1;
}
if ($do_parse_config != 0) {
- parse_config ($cfg{'control'});
}
if (defined ($args{H})) {