u
This commit is contained in:
parent
407564e7db
commit
b773cc5bcf
18
deploy-expect.sh
Normal file
18
deploy-expect.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/expect
|
||||||
|
|
||||||
|
## Usage: expect this.sh [user@hostname] [password] [filepath]
|
||||||
|
## Example: expect this.sh adot@server.log.yuanjin.net /faronear/tac.log/log.server.torm
|
||||||
|
|
||||||
|
set timeout 30
|
||||||
|
spawn ssh [lindex $argv 0]
|
||||||
|
expect {
|
||||||
|
"(yes/no)?"
|
||||||
|
{send "yes\n";exp_continue}
|
||||||
|
"password:"
|
||||||
|
{send "[lindex $argv 1]\n"}
|
||||||
|
":~"
|
||||||
|
{send "su\n";exp_continue}
|
||||||
|
"Password:"
|
||||||
|
{send "[lindex $argv 1]\ncd [lindex $argv 2] && git pull && npx pm2 restart all && npx pm2 log\n"}
|
||||||
|
}
|
||||||
|
interact
|
@ -4,7 +4,7 @@ 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
|
read -p "Enter faronear path to git pull (leave blank for default [/faronear] or [~/faronear] or [../..]) >> " FONPATH
|
||||||
if [ ! $FONPATH ]
|
if [ ! $FONPATH ]
|
||||||
then
|
then
|
||||||
if [ -d /faronear ]
|
if [ -d /faronear ]
|
||||||
@ -47,4 +47,17 @@ do
|
|||||||
cd ..;
|
cd ..;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
get_char()
|
||||||
|
{
|
||||||
|
SAVEDSTTY=`stty -g`
|
||||||
|
stty -echo
|
||||||
|
stty cbreak
|
||||||
|
dd if=/dev/tty bs=1 count=1 2> /dev/null
|
||||||
|
stty -raw
|
||||||
|
stty echo
|
||||||
|
stty $SAVEDSTTY
|
||||||
|
}
|
||||||
|
echo "Press any key to exit!"
|
||||||
|
char=`get_char`
|
@ -4,7 +4,7 @@ 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
|
read -p "Enter faronear path to git pull (leave blank for default [/faronear] or [~/faronear] or [../..]) >> " FONPATH
|
||||||
if [ ! $FONPATH ]
|
if [ ! $FONPATH ]
|
||||||
then
|
then
|
||||||
if [ -d /faronear ]
|
if [ -d /faronear ]
|
||||||
@ -47,4 +47,17 @@ do
|
|||||||
cd ..;
|
cd ..;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
get_char()
|
||||||
|
{
|
||||||
|
SAVEDSTTY=`stty -g`
|
||||||
|
stty -echo
|
||||||
|
stty cbreak
|
||||||
|
dd if=/dev/tty bs=1 count=1 2> /dev/null
|
||||||
|
stty -raw
|
||||||
|
stty echo
|
||||||
|
stty $SAVEDSTTY
|
||||||
|
}
|
||||||
|
echo "Press any key to exit!"
|
||||||
|
char=`get_char`
|
Loading…
Reference in New Issue
Block a user