mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-21 06:10:04 -07:00
Added ability to store output of collect command
Signed-off-by: David J. Allen <davidallendj@gmail.com>
This commit is contained in:
parent
589cc12962
commit
3b9f4e6070
10 changed files with 135 additions and 62 deletions
|
|
@ -2,6 +2,8 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
magellan "github.com/bikeshack/magellan/internal"
|
||||
"github.com/bikeshack/magellan/internal/db/sqlite"
|
||||
|
|
@ -46,6 +48,13 @@ var scanCmd = &cobra.Command{
|
|||
for _, r := range probeStates {
|
||||
fmt.Printf("%s:%d (%s)\n", r.Host, r.Port, r.Protocol)
|
||||
}
|
||||
|
||||
// make the dbpath dir if needed
|
||||
err := os.MkdirAll(path.Dir(dbpath), 0766)
|
||||
if err != nil {
|
||||
fmt.Printf("could not make database directory: %v", err)
|
||||
}
|
||||
|
||||
sqlite.InsertProbeResults(dbpath, &probeStates)
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue