Automatically (or more easily) reconnect to a screen session after network interruption

后端 未结 6 1161
旧巷少年郎
旧巷少年郎 2021-01-30 00:20

ADDED: This question is now, I believe, subsumed by this one: Using GNU Screen completely transparently and automatically

See also this related question:
https://s

6条回答
  •  星月不相逢
    2021-01-30 00:40

    I converted this to work on OS X .bash_profile with one addition: If no 2nd parameter is given, it will start a session "default".

    function ssc() {
        if [[ -z $2 ]]; then
            screen="default"
        else
            screen=$2
        fi
        ssh -t $1 "screen -S $screen -dr || screen -S $screen"
    }
    

提交回复
热议问题