TMP directory crud
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
76caf11636
commit
646192fd39
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22
main.go
22
main.go
|
@ -74,6 +74,8 @@ func main() {
|
|||
if err != nil {
|
||||
log.Printf("Error in fetching and monitoring containers: %v", err)
|
||||
}
|
||||
// Cleanup temporary files after each check
|
||||
cleanupTempFiles()
|
||||
default:
|
||||
time.Sleep(1 * time.Second)
|
||||
err := monitorContainers()
|
||||
|
@ -343,3 +345,23 @@ func sendNotification(content string) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func cleanupTempFiles() {
|
||||
files, err := filepath.Glob("/tmp/filtered_output*")
|
||||
if err != nil {
|
||||
log.Printf("Error finding temporary files: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Found %d temporary files", len(files))
|
||||
|
||||
for _, file := range files {
|
||||
log.Printf("Attempting to remove temporary file: %s", file)
|
||||
err := os.Remove(file)
|
||||
if err != nil {
|
||||
log.Printf("Error removing temporary file %s: %v", file, err)
|
||||
} else {
|
||||
log.Printf("Removed temporary file %s", file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue