fixed the reload utility

This commit is contained in:
SJ 2013-09-29 10:24:05 +02:00
parent e9cbc803ab
commit a1060b76d0
4 changed files with 15 additions and 7 deletions

5
configure vendored
View File

@ -3485,7 +3485,7 @@ fi
echo "\"Configure command: ./configure $PARAMS\"" >> $CONFIGURE_PARAMS_FILE
SUBDIRS="src etc util init.d test"
SUBDIRS="src etc util init.d test contrib/reload"
@ -4830,7 +4830,7 @@ CFLAGS="$static -O2 -Wall -g"
LIBS="$antispam_libs $sunos_libs "
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o $objs"
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile"
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile contrib/reload/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -5530,6 +5530,7 @@ do
"init.d/Makefile") CONFIG_FILES="$CONFIG_FILES init.d/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
"contrib/imap/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/imap/Makefile" ;;
"contrib/reload/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/reload/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@ -85,7 +85,7 @@ fi
echo "\"Configure command: ./configure $PARAMS\"" >> $CONFIGURE_PARAMS_FILE
SUBDIRS="src etc util init.d test"
SUBDIRS="src etc util init.d test contrib/reload"
dnl static build
@ -524,7 +524,7 @@ CFLAGS="$static -O2 -Wall -g"
LIBS="$antispam_libs $sunos_libs "
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o $objs"
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile])
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile contrib/reload/Makefile])
AC_OUTPUT

View File

@ -25,7 +25,7 @@ struct __config cfg;
void fatal(char *s){
printf("pilerctl: fatal: %s\n", s);
syslog(LOG_PRIORITY, "fatal: %s", s);
exit(1);
}
@ -35,6 +35,8 @@ int main(int argc, char **argv){
int pid;
FILE *f;
(void) openlog("pilerreload", LOG_PID, LOG_MAIL);
cfg = read_config(CONFIG_FILE);
f = fopen(cfg.pidfile, "r");
@ -46,7 +48,11 @@ int main(int argc, char **argv){
pid = atoi(buf);
if(pid > 1) kill(pid, SIGHUP);
if(pid > 1){
if(kill(pid, SIGHUP) == 0) syslog(LOG_PRIORITY, "reloaded");
else syslog(LOG_PRIORITY, "failed to reload");
}
else fatal("invalid pid");
return 0;
}

View File

@ -35,10 +35,11 @@ install:
$(INSTALL) -m 0755 $(srcdir)/indexer.delta.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/indexer.main.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/import.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/purge.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/postinstall.sh $(DESTDIR)$(libexecdir)/piler
clean:
rm -f postinstall.sh
distclean: clean
rm -f Makefile