-
Notifications
You must be signed in to change notification settings - Fork 131
/
root.go
47 lines (40 loc) · 1.18 KB
/
root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package cmd
import (
"os"
"time"
"github.com/spf13/cobra"
lib "github.com/cvmfs/ducc/lib"
l "github.com/cvmfs/ducc/log"
"github.com/cvmfs/ducc/temp"
)
func init() {
rootCmd.PersistentFlags().StringVarP(&temp.TemporaryBaseDir, "temporary-dir", "t", "", "Temporary directory to store files necessary during the conversion of images, it can grow large ~1G. If not set we use the standard of the system $TMP, usually /tmp")
if temp.TemporaryBaseDir == "" {
temp.TemporaryBaseDir = os.Getenv("DUCC_TMP_DIR")
}
rootCmd.PersistentFlags().StringVarP(&lib.NotificationFile, "notification-file", "n", "", "File where to publish notification about DUCC progression")
}
var rootCmd = &cobra.Command{
Use: "cvmfs_ducc",
Short: "Show the several commands available.",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
lib.SetupNotification()
},
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
lib.StopNotification()
},
}
func EntryPoint() {
rootCmd.Execute()
}
func AliveMessage() {
ticker := time.NewTicker(30 * time.Second)
go func() {
for range ticker.C {
l.Log().Info("Process alive")
}
}()
}