Created
May 24, 2022 07:07
-
-
Save jemsgit/a861c71c22f217aa61dbc4c55d17e8a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
set pass [lindex $argv 0]; | |
spawn rsync -au --progress dist/ -e "ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" [email protected]:/path/to/project/folder | |
expect "passphrase" | |
send "$pass\r" | |
expect eof | |
spawn ssh -i ~/.ssh/id_rsa [email protected] "cd /path/to/project/folder && npm i" | |
expect "passphrase" | |
send "$pass\r" | |
expect eof | |
spawn ssh -i ~/.ssh/id_rsa [email protected] "pm2 restart poster" | |
expect "passphrase" | |
send "$pass\r" | |
sleep 5 | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment