Skip to content

Instantly share code, notes, and snippets.

@jemsgit
Created May 24, 2022 07:07
Show Gist options
  • Save jemsgit/a861c71c22f217aa61dbc4c55d17e8a7 to your computer and use it in GitHub Desktop.
Save jemsgit/a861c71c22f217aa61dbc4c55d17e8a7 to your computer and use it in GitHub Desktop.
#!/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