commands

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S3_REGION = "eu-north-1" // lightsail.RegionNameEuCentral1
	S3_BUCKET = "cosd-databackup"
)

Variables

View Source
var AgentCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "agent",
		Short: "start backup agent",
		Long:  "start back agent and regularly sends cosd data files to backup server",
		Run:   startBackUpAgent,
	}
	cmd.Flags().StringVarP(&dataDir, "data_dir", "d", "", "directory of cosd data")
	cmd.Flags().Int32VarP(&interval, "interval", "i", 86400, "backup data every interval seconds")

	return cmd
}
View Source
var ClientCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "client",
		Short: "start backup client",
		Run:   startBackUpClient,
	}
	cmd.Flags().Int16VarP(&serverPort, "server_port", "p", 9722, "")
	cmd.Flags().StringVarP(&serverIP, "server_ip", "i", "", "")
	return cmd
}
View Source
var ServerCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "server",
		Short: "start backup server",
		Run:   startBackUpServer,
	}
	cmd.Flags().Int16VarP(&port, "port", "p", 9722, "")
	cmd.Flags().StringVarP(&ip, "ip", "i", "", "")
	cmd.Flags().StringVarP(&backupDir, "dir", "d", "~/contentos_data_backup", "")
	return cmd
}

Functions

func AddFileToS3

func AddFileToS3(s *session.Session, fileDir string) error

AddFileToS3 will upload a single file to S3, it will require a pre-built aws session and will set file info like content type and encryption on the uploaded file.

func Compress

func Compress(files []*os.File, dest string) error

func DeCompress

func DeCompress(tarFile, dest string) error

func SendToS3

func SendToS3() error

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

func (*Agent) Run

func (a *Agent) Run()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL