diff --git a/camera/camera.go b/camera/camera.go index 4a0c536..4af4001 100644 --- a/camera/camera.go +++ b/camera/camera.go @@ -8,6 +8,7 @@ import ( "image/png" "net/http" "os" + "os/exec" "strconv" "time" @@ -53,6 +54,13 @@ func CaptureImage() bool { log.Fatal().Err(err).Msgf("") } else { log.Info().Msg("New image created: " + config.StoragePath + filename) + + cmd := exec.Command("cp", config.StoragePath+filename, config.StoragePath+"/latest.png") + + err := cmd.Run() + if err != nil { + log.Error().Msgf("Error copying to latest.") + } } }