Setup upload dir watcher at the last step.
This commit is contained in:
parent
271c27f4ad
commit
3b15052330
@ -38,19 +38,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
watcha, err := watcher.NewInotifyWatcher()
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer watcha.Close()
|
||||
|
||||
if err := watcha.AddWatch(*uploadDir, watcher.CrDelMask); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
uploadDirNotify := make(chan uint32)
|
||||
go watcha.WatchForMask(uploadDirNotify, watcher.CrDelMask)
|
||||
|
||||
hashSalt, err := os.ReadFile(path.Join(os.Getenv("CREDENTIALS_DIRECTORY"), "salt"))
|
||||
if err != nil {
|
||||
log.Fatalln("failed to read hash salt file:", err)
|
||||
@ -104,6 +91,19 @@ func main() {
|
||||
doneSignal := make(chan os.Signal, 1)
|
||||
signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
watcha, err := watcher.NewInotifyWatcher()
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer watcha.Close()
|
||||
|
||||
if err := watcha.AddWatch(*uploadDir, watcher.CrDelMask); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
uploadDirNotify := make(chan uint32)
|
||||
go watcha.WatchForMask(uploadDirNotify, watcher.CrDelMask)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
|
Loading…
Reference in New Issue
Block a user