summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-06 16:13:08 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-06 16:19:26 +0530
commitf2af6ba15466f7ac39f2c12ea29fab5b0c5415c4 (patch)
tree605f2075aadd4ff81732e572f27132fff8a47de4 /cmd
parent4ef5f7b379b37baeb3b6de1999be16d089e29738 (diff)
usage/Init: init
Diffstat (limited to 'cmd')
-rw-r--r--cmd/redq/main.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/cmd/redq/main.go b/cmd/redq/main.go
index df275d6..abac395 100644
--- a/cmd/redq/main.go
+++ b/cmd/redq/main.go
@@ -14,10 +14,7 @@ import (
)
func main() {
- u := &usage.Usage {
- Data : make(usage.UsageMap),
- }
-
+ var u usage.Usage
iface, err := net.InterfaceByName("wlan0")
if err != nil {
@@ -32,14 +29,15 @@ func main() {
defer conn.Close(ctx)
queries := db.New(conn)
+ err = u.Init(iface)
+ if err != nil {
+ os.Exit(0)
+ }
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM)
go func () {
<- sigs
- err := u.UpdateDb(queries, ctx, false)
- if err != nil {
- log.Printf("updating Database: %s", err)
- }
+ u.CleanUp(queries, ctx)
os.Exit(0)
}()