From a9d38e5de5cceb667bec3db15fed68f7e8d96a8b Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 13 Apr 2020 10:07:46 +0300 Subject: Fix triplet processing in daemon mode. * src/watcher.c (fopenat_ro): New function. * src/verify.c (fill_project_name): Use fopenat_ro. * src/gpg.c (recursive_rmdir): return silently if the directory does not exist. (verify_directive_signature): Use fopenat_ro. * src/job.c: Change state definitions from bitmask to enum. * src/triplet.c (triplet_processor): A pointer to the spool is passed in proc_data. Process only triplets with this spool. (triplet_processor): Modify accordingly. Facilitate writing tests for daemon mode. * src/wydawca.c (cron_option,daemon_mode): Remove. (wy_mode, wy_mode_option): New variables. (main): Use wy_mode to determine operating mode. * src/wydawca.h (daemon_mode): Remove extern. (wy_mode): New extern. * src/cmdline.opt: New option --daemon. * src/config.c: Change handling of the "daemon" statement. * src/net.c: Test hook: if WYDAWCA_NOTIFY_PARENT=1 send SIGUSR1 to parent after setting up the listener. * doc/wydawca.texi: Describe the --daemon option. Testsuite: 1. Place source and destination directories in the working directory for each particular test. Thus the spool cleanup function becomes unnecessary. 2. Add tests for wydawca daemon mode (inotify). * configure.ac (WY_INOTIFY): New substitution variable for use in testsuite. * tests/wyasync.c: New source. Auxiliary program to test wydawca daemon mode. * tests/wyinit.c: New source. Extract source and destination directory names from the wydawca configuration file and create missing directories. * tests/Makefile.am: Build wyasync and wyinit. (TESTSUITE_AT): Add inotify-ok.at * tests/atlocal.in (WY_INOTIFY): New variable. (wydawca_init_testdirs): Remove. (wydawca_clean_testdirs): Remove. (wydawca_config): Call wyinit to initialize spools and destinatiuon directories. (wydawca_upload): Change source directory. * tests/etc/mailstats.cfin: Put mail.out in CWD. * tests/etc/notify.cfin: Likewise. * tests/etc/wydawca.cfin: Add pidfile statement in case wydawca is run as daemon. Place all source and destination directories in CWD. * tests/testsuite.at (AT_WYDAWCA_DAEMON): New macro. * tests/inotify-ok.at: New test. * tests/check-fail.at: Update. * tests/check-notify.at: Update. * tests/check-ok.at: Update. * tests/mailstats.at: Update. * tests/notify-upl.at: Update. * tests/upl11.at: Update. * tests/upl12f.at: Update. * tests/upl12t.at: Update. * tests/upload-dry.at: Update. * tests/upload.at: Update. --- doc/wydawca.texi | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/wydawca.texi b/doc/wydawca.texi index f7245ee..127abde 100644 --- a/doc/wydawca.texi +++ b/doc/wydawca.texi @@ -413,13 +413,17 @@ all diagnostics via @command{syslog}, and the option the standard error. @xopindex{cron, described} - The operation mode is configured in the configuration file. If the -latter configures daemon mode, you can still instruct -@command{wydawca} to run as a cron job by the @option{--cron} command -line option. This may be needed, for example, to schedule a daily + The operation mode can be configured in the configuration file or +in the command line. Command line options take precedence over +configuration settings. The cron mode is the default. It can also +be requested explicitly, using the @option{--cron} command +line option. This may be needed, for example, to schedule a daily @command{wydawca} run when the main daemon instance is already running. +@xopindex{daemon, described} +Similarly, the @option{--daemon} option enables daemon mode. + @anchor{spool selection} Usually @command{wydawca} attempts to process all the configured spools. You may instruct it to process only a subset of these @@ -3692,6 +3696,10 @@ Run in cron mode. @xref{starting,, cron}. @xref{stderr, The @option{--syslog} option}. +@opsummary{daemon} +@item --daemon +Run in daemon mode. @xref{starting,, daemon}. + @opsummary{debug} @sopindex{d, summary} @item --debug -- cgit v1.2.1