diff --git a/freshclam/CMakeLists.txt b/freshclam/CMakeLists.txt index df5a187563..ef3616fe32 100644 --- a/freshclam/CMakeLists.txt +++ b/freshclam/CMakeLists.txt @@ -61,4 +61,18 @@ if(SYSTEMD_FOUND) FILES ${CMAKE_CURRENT_BINARY_DIR}/clamav-freshclam.service DESTINATION ${SYSTEMD_UNIT_DIR} COMPONENT programs) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/clamav-freshclam-once.service.in + ${CMAKE_CURRENT_BINARY_DIR}/clamav-freshclam-once.service @ONLY) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/clamav-freshclam-once.service + DESTINATION ${SYSTEMD_UNIT_DIR} + COMPONENT programs) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/clamav-freshclam-once.timer.in + ${CMAKE_CURRENT_BINARY_DIR}/clamav-freshclam-once.timer @ONLY) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/clamav-freshclam-once.timer + DESTINATION ${SYSTEMD_UNIT_DIR} + COMPONENT programs) endif() diff --git a/freshclam/clamav-freshclam-once.service.in b/freshclam/clamav-freshclam-once.service.in new file mode 100644 index 0000000000..5aad7a17d8 --- /dev/null +++ b/freshclam/clamav-freshclam-once.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=Update ClamAV virus database once +Documentation=man:freshclam(1) man:freshclam.conf(5) https://docs.clamav.net/ +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +ExecStart=@prefix@/bin/freshclam + +[Install] +WantedBy=multi-user.target diff --git a/freshclam/clamav-freshclam-once.timer.in b/freshclam/clamav-freshclam-once.timer.in new file mode 100644 index 0000000000..8d2a6ef3e4 --- /dev/null +++ b/freshclam/clamav-freshclam-once.timer.in @@ -0,0 +1,11 @@ +[Unit] +Description=Daily ClamAV virus database update + +[Timer] +OnCalendar=daily +AccuracySec=1h +RandomizedDelaySec=1h +Persistent=true + +[Install] +WantedBy=timers.target