跳到主要内容

2 篇博文 含有标签「computing」

查看所有标签

· 阅读需 1 分钟
大盗天放

expect spawn and send

#!/usr/bin/expect -f

#set timeout 20

set sp YourSudoPassword
set passwd UserPassword

# sudo is not always necessary

spawn sudo ssh user@ip

expect "Password:"
send "$sp\r"

expect "some stuff"
send "$passwd\r"
interact
  • spawn: run commands
  • expect: wait for specify pattern
  • send: to send the strings to the process

· 阅读需 1 分钟
大盗天放

If you want to use jupyter on remote server, this blog might be useful.

Step1: Run jupyter without browser on remote server:

jupyter notebook --no-browser --port=8888

Step2: Bind local port to remote server:

ssh -N -f -L localhost:8888:ip:8888 user@ip

Step3: Open browser on you local machine and direct to localhost:8888

To Stop Local Process:

ps aux|grep jupyter

kill pid