https://github.com/obgnail/go-spawn
简易的 spawn 工具,主要为了解决 spawn 命令在切换用户后就无法使用的问题。此工具的全部命令都会在一个 shell 中执行。 对 spawn 命令语法稍作改变。
https://github.com/obgnail/go-spawn
command-line command-line-tool golang spawn ssh
Last synced: 9 months ago
JSON representation
简易的 spawn 工具,主要为了解决 spawn 命令在切换用户后就无法使用的问题。此工具的全部命令都会在一个 shell 中执行。 对 spawn 命令语法稍作改变。
- Host: GitHub
- URL: https://github.com/obgnail/go-spawn
- Owner: obgnail
- Created: 2022-07-12T04:10:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-12T04:15:36.000Z (over 3 years ago)
- Last Synced: 2025-02-18T01:41:56.688Z (12 months ago)
- Topics: command-line, command-line-tool, golang, spawn, ssh
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-spawn
简易的 spawn 工具,主要为了解决 spawn 命令在切换用户后就无法使用的问题。此工具的全部命令都会在一个 shell 中执行。
对 spawn 命令语法稍作改变。
## usage
config:
```json
{
"addr": "aaa.bbb.ccc.ddd:22",
"user": "XXXXX",
"password": "",
"private_key": "",
"ssh_dir_path": "",
"timeout": -1,
"command_chain_path": "config/commands.txt"
}
```
commands.txt:
```
expect "$" { cd .. }
expect "$" { su your-account }
expect "Password:" { your-password }
expect "$" { cd XXXX/ }
expect "$" { ./YYYY.sh args }
expect "$" { su super-user }
expect "#" { docker ps -a }
expect "#" { docker exec -it 92a2024fa59f bash }
expect "#" { whoami }
```