TMP directory crud
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Colin 2024-06-13 11:04:06 -04:00
parent 76caf11636
commit 646192fd39
8 changed files with 22 additions and 0 deletions

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
View File

@ -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)
}
}
}