Commit 31ec43b9 authored by fredix's avatar fredix

add a remove file after open option

parent 50f21bc4
......@@ -63,6 +63,7 @@ port = 12666
removetime = "1h"
# frd can check if a file to remove is open, so it will be remove after the removetime_after_open time
# the time should be shorter than removetime
removefile_after_open = false
removetime_after_open = "10m"
# scan le répertoire toutes les , format : Nh Nm Ns
loop_sleep = "3m"
\ No newline at end of file
......@@ -65,6 +65,7 @@ type Watcher struct {
Removetime string
Loop_sleep string
Removetime_after_open string
Removefile_after_open bool
}
// wait_files map[path_file]type => wait_files map[/tmp/test/toto.txt]rm (this mean srm delete the file) OR
......@@ -607,7 +608,7 @@ func FilesWatcher(frdconf *frdlog.FrdConfig, watcher Watcher) {
// ignore signals events about directory
if ei.Path() != watcher.Directory {
if len(watcher.Removetime_after_open) != 0 {
if len(watcher.Removetime_after_open) != 0 && (watcher.Removefile_after_open == true) {
if _, exist := files_counter.wait_files[ei.Path()]; exist {
frdlog.PrintLog(frdconf, "notify.InOpen, file exist in map")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment