Skip to content

Commit

Permalink
Systemd timer for freshclam updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-werner authored and micahsnyder committed Aug 3, 2023
1 parent b4f0836 commit 4d26bc6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
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

0 comments on commit 4d26bc6

Please sign in to comment.