30 lines
589 B
Go
30 lines
589 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/exec"
|
|
"time"
|
|
)
|
|
|
|
func freshclam_update() {
|
|
for {
|
|
freshclam_update_routine()
|
|
time.Sleep(1 * time.Hour)
|
|
}
|
|
}
|
|
|
|
func freshclam_update_routine() {
|
|
log.Println("freshclam_update_routine(): refreshing clamav database...")
|
|
|
|
freshclamCommand := exec.Command("freshclam")
|
|
freshclamCommand.Stdout = os.Stdout
|
|
freshclamCommand.Stderr = os.Stderr
|
|
err := freshclamCommand.Run()
|
|
if err != nil {
|
|
log.Println("freshclam_update_routine(): error running freshclam:", err)
|
|
}
|
|
|
|
log.Println("freshclam_update_routine(): done refreshing clamav database")
|
|
}
|