Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd timer for freshclam updates #962

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions freshclam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
12 changes: 12 additions & 0 deletions freshclam/clamav-freshclam-once.service.in
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions freshclam/clamav-freshclam-once.timer.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Daily ClamAV virus database update

[Timer]
OnCalendar=daily
AccuracySec=1h
RandomizedDelaySec=1h
Persistent=true

[Install]
WantedBy=timers.target