feat: 病毒扫描增加状态判断 (#5817)
Some checks failed
Build Test / build-linux-binary (push) Failing after -6m31s
Build / SonarCloud (push) Failing after -6m38s
sync2gitee / repo-sync (push) Failing after -6m39s

Refs #5769
This commit is contained in:
ssongliu 2024-07-15 12:05:26 +08:00 committed by GitHub
parent eb4d550305
commit 12c6fe6331
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -75,6 +75,10 @@ func (c *ClamService) LoadBaseInfo() (dto.ClamBaseInfo, error) {
baseInfo.FreshIsExist = true
baseInfo.FreshIsActive, _ = systemctl.IsActive(freshClamService)
}
stdout, err := cmd.Exec("which clamdscan")
if err != nil || (len(strings.ReplaceAll(stdout, "\n", "")) == 0 && strings.HasPrefix(stdout, "/")) {
baseInfo.IsActive = false
}
if baseInfo.IsActive {
version, err := cmd.Exec("clamdscan --version")