u
This commit is contained in:
parent
b773cc5bcf
commit
98bb2c5681
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/expect
|
#!/usr/bin/expect
|
||||||
|
|
||||||
## Usage: expect this.sh [user@hostname] [password] [filepath]
|
## Usage: expect this.sh [user@hostname] [filepath] [password]
|
||||||
## Example: expect this.sh adot@server.log.yuanjin.net /faronear/tac.log/log.server.torm
|
## Example: expect this.sh adot@server.log.yuanjin.net /faronear/tac.log/log.server.torm 密码
|
||||||
|
|
||||||
set timeout 30
|
set timeout 30
|
||||||
spawn ssh [lindex $argv 0]
|
spawn ssh [lindex $argv 0]
|
||||||
@ -9,10 +9,10 @@ expect {
|
|||||||
"(yes/no)?"
|
"(yes/no)?"
|
||||||
{send "yes\n";exp_continue}
|
{send "yes\n";exp_continue}
|
||||||
"password:"
|
"password:"
|
||||||
{send "[lindex $argv 1]\n"}
|
{send "[lindex $argv 2]\n"}
|
||||||
":~"
|
":~"
|
||||||
{send "su\n";exp_continue}
|
{send "su\n";exp_continue}
|
||||||
"Password:"
|
"Password:"
|
||||||
{send "[lindex $argv 1]\ncd [lindex $argv 2] && git pull && npx pm2 restart all && npx pm2 log\n"}
|
{send "[lindex $argv 2]\ncd [lindex $argv 1] && git pull && npx pm2 restart all && npx pm2 log\n"}
|
||||||
}
|
}
|
||||||
interact
|
interact
|
@ -1,19 +1,19 @@
|
|||||||
#!/usr/bin/expect
|
#!/usr/bin/expect
|
||||||
|
|
||||||
# Usage: expect this.sh [hostname] [port] [username] [password]
|
# Usage: expect this.sh [hostname] [username] [password]
|
||||||
|
|
||||||
set timeout 30
|
set timeout 30
|
||||||
spawn ssh -p [lindex $argv 1] [lindex $argv 2]@[lindex $argv 0]
|
spawn ssh [lindex $argv 1]@[lindex $argv 0] -p 22
|
||||||
expect {
|
expect {
|
||||||
"(yes/no)?"
|
"(yes/no)?"
|
||||||
{send "yes\n";exp_continue}
|
{send "yes\n";exp_continue}
|
||||||
"password:"
|
"password:"
|
||||||
{send "[lindex $argv 3]\n";exp_continue}
|
{send "[lindex $argv 2]\n";exp_continue}
|
||||||
":~"
|
":~"
|
||||||
{send "su\n";exp_continue}
|
{send "su\n";exp_continue}
|
||||||
"Password:"
|
"Password:"
|
||||||
# {send "[lindex $argv 3]\ncd /faronear\n"}
|
# {send "[lindex $argv 3]\ncd /faronear\n"}
|
||||||
# "密码:"
|
# "密码:"
|
||||||
{send "[lindex $argv 3]\ncd /faronear\n"}
|
{send "[lindex $argv 2]\ncd /faronear\n"}
|
||||||
}
|
}
|
||||||
interact
|
interact
|
@ -4,7 +4,8 @@ if [ $1 ]
|
|||||||
then
|
then
|
||||||
FONPATH=$1
|
FONPATH=$1
|
||||||
else
|
else
|
||||||
read -p "Enter faronear path to git pull (leave blank for default [/faronear] or [~/faronear] or [../..]) >> " FONPATH
|
echo Leave blank for default [/faronear], [~/faronear], [../..],
|
||||||
|
read -p "or enter faronear path to git pull >> " FONPATH
|
||||||
if [ ! $FONPATH ]
|
if [ ! $FONPATH ]
|
||||||
then
|
then
|
||||||
if [ -d /faronear ]
|
if [ -d /faronear ]
|
||||||
|
@ -4,7 +4,8 @@ if [ $1 ]
|
|||||||
then
|
then
|
||||||
FONPATH=$1
|
FONPATH=$1
|
||||||
else
|
else
|
||||||
read -p "Enter faronear path to git pull (leave blank for default [/faronear] or [~/faronear] or [../..]) >> " FONPATH
|
echo Leave blank for default [/faronear], [~/faronear], [../..],
|
||||||
|
read -p "or enter faronear path to git pull >> " FONPATH
|
||||||
if [ ! $FONPATH ]
|
if [ ! $FONPATH ]
|
||||||
then
|
then
|
||||||
if [ -d /faronear ]
|
if [ -d /faronear ]
|
||||||
|
Loading…
Reference in New Issue
Block a user