mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-03 16:05:24 -04:00
SIGHUP means reload. zmc responds by closing its events, disconnecting the camera and reconnecting; the perl daemons respond by exiting so zmdc restarts them. zmdc.pl logrot hupped every managed process, so the nightly logrotate run cost about 8 seconds of capture on a default install. Rotating a log file only needs the daemon to drop its file handle, so use a separate signal for it. SIGWINCH is otherwise unused, is ignored by default and exists on every supported platform. - Logger (C++) installs a SIGWINCH handler beside its USR1/USR2 handler. The handler only sets a flag; the next logPrint closes the file and the write reopens it at the original path. This covers every C++ binary without touching any daemon's main loop. - Logger.pm registers WINCH alongside HUP in logSetSignal, which logInit already calls, so the scripts that install their own HUP handler still rotate. - zmdc.pl logrot sends WINCH. The logrotate config is unchanged - it still calls zmpkg.pl logrot. Filter.pm and FilterTerm.php justified MAX_EVENT_DAYS by events not outliving the nightly HUP, which is no longer what bounds them; cite SectionLength. Tests: tests/zm_logger_rotate.cpp and tests/perl/test_log_rotate_signal.pl both log, rename the file out from under the process, confirm writes still land in the renamed file, signal WINCH and confirm the original path is written again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NDhTBPj9xEaT52pRmAufaP