whileループのautosshとsshの違いは何ですか?

whileループのautosshとsshの違いは何ですか?

したがって、ウェブサイトそれは言う:

Autossh は、ssh のコピーを開始して監視し、ssh が死んだ場合やトラフィックの転送が中断した場合に必要に応じて再起動するプログラムです。

しかし、私は実際にautosshと内部SSHトンネルの違いを見ることはできませんwhile loop。私は個人的に切断されたときにトンネルを再起動するためにこのSSHトンネルスクリプトを使用します。

#!/bin/bash

while true; do
    ssh -vND 1080 username@host
    sleep 1
done

それでは、2つの違いは何ですか?関数内でautosshがwhile loopsshよりも多くの利点を持っている場合は、喜んで使用します。

ベストアンサー1

主な違いは、autosshマニュアルページで読むことができるオプションがたくさんあることです。

たとえば、

-f      causes autossh to drop to the background before running ssh. The -f flag is stripped from arguments passed to ssh. Note that there is a crucial a difference between -f with autossh, and -f with ssh: when used with autossh ssh will be unable to ask for passwords or passphrases. When -f is used, the "starting gate" time (see AUTOSSH_GATETIME) is set to 0.

おすすめ記事