Documentation ¶
Index ¶
- Variables
- type T
- func (t T) NtpClient(m map[string]string)
- func (t T) NtpNetclient(m map[string]string)
- func (t T) NtpServer(m map[string]string)
- func (t T) ShellExecute(m map[string]string)
- func (t T) ShellScp(m map[string]string)
- func (t T) ShellStream(m map[string]string)
- func (t T) TelnetTest(m map[string]string)
Constants ¶
This section is empty.
Variables ¶
var CmdMod = &cobra.Command{ Use: "mod", Short: "module", Long: `module.`, Run: func(cmd *cobra.Command, args []string) { logger := configs.NewLogger(true, true, true, true, false, "console") if len(args) < 2 { logger.Info("Args must >= 1!") fmt.Println("###################Error Exist##################") os.Exit(1) } else { modName := args[0] modActionName := args[1] bagSizes := []int{5} cmFilter := closestmatch.New(args, bagSizes) modFrom := cmFilter.Closest("from=") var modExecContent map[string]string // 最终解析后传递给 switch modFrom { case "from=str", "from=string": modExecContent = cmdStr2Content(args[2:]) default: modExecContent = file2Content(modName, modActionName, strings.TrimLeft(modFrom, "from="), logger) } execAction(modName, modActionName, modExecContent) } }, }
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct{}
func (T) NtpNetclient ¶
func (T) ShellExecute ¶
Example: $ ./toolBox mod shell execute from=str 172.16.4.111:22:yanfa:redhat@2020 "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi" or $ ./toolBox mod shell execute from=str 172.16.4.111:22:yanfa "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi"
说明: - 不输入密码的时候 -> ip:port:user;输入密码的时候 -> ip:port:user:password
func (T) ShellScp ¶
Example: $ ./toolBox mod scp 172.16.4.110:22:yanfa:redhat@2020 /tmp/xxx /home/yanfa/xxx or $ ./toolBox mod scp 172.16.4.110:22:yanfa /tmp/xxx /home/yanfa/xxx
说明: - 不输入密码的时候 -> ip:port:user;输入密码的时候 -> ip:port:user:password
func (T) ShellStream ¶
Example: $ ./toolBox mod shell stream from=str 172.16.4.111:22:yanfa:redhat@2020 "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi" or $ ./toolBox mod shell stream from=str 172.16.4.111:22:yanfa "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi"
说明: - 不输入密码的时候 -> ip:port:user;输入密码的时候 -> ip:port:user:password
func (T) TelnetTest ¶
Example: $ ./op-tools mod telnet test from=str 172.16.4.128:22 172.16.4.129:22