Documentation
¶
Index ¶
- func ParallelScp(servers []ServerInternal, srcPath string, dstPath string, mode os.FileMode) chan error
- func RemoteWriteFile(b []byte, dstPath string, instance ServerInternal, mode os.FileMode)
- func ReturnParalleRunResult(servers []ServerInternal, cmd string) chan ShellResult
- func Run(b []byte, logger *logrus.Logger) error
- func ScpFile(srcPath string, dstPath string, server ServerInternal, mode os.FileMode)
- type ExecutorExternal
- type ExecutorInternal
- type ServerExternal
- type ServerInternal
- func (server ServerInternal) CommandExists(cmd string) bool
- func (server ServerInternal) HomeDir() string
- func (server ServerInternal) InstallSoft(installScript string) error
- func (server ServerInternal) MoveDirFiles(srcDir string, dstDir string)
- func (server ServerInternal) RemoteShellReturnStd(cmd string) string
- func (server ServerInternal) ReturnRunResult(cmd string) ShellResult
- func (server ServerInternal) Scp(srcPath string, dstPath string, mode os.FileMode, showProcessBar bool) error
- func (server ServerInternal) ServerFilter(excludes []string) []ServerInternal
- func (server ServerInternal) TailFile(path string, offset int64, whence int, stopCh <-chan struct{})
- func (server ServerInternal) WriteRemoteFile(b []byte, dstPath string, mode os.FileMode)
- type ServerListExternal
- type ServerListInternal
- type ShellResult
- type ShellResultSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParallelScp ¶
func RemoteWriteFile ¶
func RemoteWriteFile(b []byte, dstPath string, instance ServerInternal, mode os.FileMode)
func ReturnParalleRunResult ¶
func ReturnParalleRunResult(servers []ServerInternal, cmd string) chan ShellResult
Types ¶
type ExecutorExternal ¶
type ExecutorExternal struct {
Servers []ServerExternal `yaml:"server"`
Excludes []string `yaml:"excludes"`
Script string `yaml:"script"`
}
type ExecutorInternal ¶
type ExecutorInternal struct {
Servers []ServerInternal
Script string
}
func (ExecutorInternal) ParallelRun ¶
func (executor ExecutorInternal) ParallelRun(logger *logrus.Logger) chan ShellResult
type ServerExternal ¶
type ServerInternal ¶
type ServerInternal struct {
Host string
Port string
Username string
Password string
PrivateKeyPath string
}
func ParseServerList ¶
func ParseServerList(b []byte) ([]ServerInternal, error)
ParseServerList ServerList反序列化
func (ServerInternal) CommandExists ¶
func (server ServerInternal) CommandExists(cmd string) bool
func (ServerInternal) HomeDir ¶
func (server ServerInternal) HomeDir() string
HomeDir /root or /home/username
func (ServerInternal) InstallSoft ¶
func (server ServerInternal) InstallSoft(installScript string) error
func (ServerInternal) MoveDirFiles ¶
func (server ServerInternal) MoveDirFiles(srcDir string, dstDir string)
MoveDirFiles 移动目录下文件至新目录
func (ServerInternal) RemoteShellReturnStd ¶
func (server ServerInternal) RemoteShellReturnStd(cmd string) string
func (ServerInternal) ReturnRunResult ¶
func (server ServerInternal) ReturnRunResult(cmd string) ShellResult
func (ServerInternal) Scp ¶
func (server ServerInternal) Scp(srcPath string, dstPath string, mode os.FileMode, showProcessBar bool) error
Scp 远程写文件
func (ServerInternal) ServerFilter ¶
func (server ServerInternal) ServerFilter(excludes []string) []ServerInternal
ServerFilter 解析ip地址区间类型,排除excludes数组内的主机
func (ServerInternal) TailFile ¶
func (server ServerInternal) TailFile(path string, offset int64, whence int, stopCh <-chan struct{})
TailFile all & real time
func (ServerInternal) WriteRemoteFile ¶
func (server ServerInternal) WriteRemoteFile(b []byte, dstPath string, mode os.FileMode)
type ServerListExternal ¶
type ServerListExternal struct {
Servers []ServerExternal `yaml:"server"`
Excludes []string `yaml:"excludes"`
}
type ServerListInternal ¶
type ServerListInternal struct {
Servers []ServerInternal
Excludes []string
}
func (ServerListInternal) ServerListFilter ¶
func (serverListInternal ServerListInternal) ServerListFilter() []ServerInternal
ServerListFilter 解析、过滤server主机列表 解析ip地址区间类型,排除excludes数组内的主机
type ShellResult ¶
type ShellResult struct {
Host string `table:"主机地址"`
Cmd string `table:"执行语句"`
Code int `table:"退出码"`
Status string `table:"执行状态"`
StdOut string `table:"执行结果"`
Output string `table:"标准输出"`
StdErrMsg string
Err error
}
func ReadErrorChanWithSelect ¶
func ReadErrorChanWithSelect(ch chan ShellResult) (value ShellResult, err error)
ReadErrorChanWithSelect select结构实现通道读
func ReadWithSelect ¶
func ReadWithSelect(ch chan ShellResult) (value ShellResult, err error)
ReadWithSelect select结构实现通道读
type ShellResultSlice ¶
type ShellResultSlice []ShellResult
func (ShellResultSlice) Len ¶
func (re ShellResultSlice) Len() int
func (ShellResultSlice) Less ¶
func (re ShellResultSlice) Less(i, j int) bool
func (ShellResultSlice) Swap ¶
func (re ShellResultSlice) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.