Сценарий оболочки для использования mount?

Вы всегда можете указать в своем переходнике Мультиплексирование в OpenSSH

Multiplexing is the ability to send more than one signal over a single line or connection. With multiplexing, OpenSSH can re-use an existing TCP connection for multiple concurrent SSH sessions rather than creating a new one each time.

An advantage with SSH multiplexing is that the overhead of creating new TCP connections is eliminated. The overall number of connections that a machine may accept is a finite resource and the limit is more noticeable on some machines than on others, and varies greatly depending on both load and usage. There is also significant delay when opening a new connection. Activities that repeatedly open new connections can be significantly sped up using multiplexing.

Для этого в/etc/ssh/ssh_config:

ControlMaster auto
ControlPath ~/.ssh/controlmasters/ssh_mux_%h_%p_%r
ControlPersist 30m

Таким образом, любые последовательные подключения к одному и тому же серверу в течение следующих 30 минут будут выполняться повторно с использованием предыдущего подключения ssh.

Вы также можете определить его для машины или группы машин. Взято по предоставленной ссылке.

Host machine1
    HostName machine1.example.org
    ControlPath ~/.ssh/controlmasters/%r@%h:%p
    ControlMaster auto
    ControlPersist 10m

0
16.10.2020, 12:27
2 ответа

Почти так же. Просто создайте bash-скрипт:

vi mount.sh

Insert or i отвечает за вставку. Правая кнопка мыши для вставки. Esc для выхода из режима вставки. Затем все, что вам нужно сделать после Esc, это ввести :x, чтобы сохранить и выйти из режима редактирования файла сценария bash.

Добавить шебанг проверить, что такое шебанг в Википедии

Добавьте команду в файл ниже shebang.

mount --bind /dev/xyz /abc

Сделать скрипт bash исполняемым с помощью

chmod +x mount.sh
0
18.03.2021, 22:56
echo "mount --bind /dev/xyz /abc" >mount.sh && chmod 755 mount.sh &&./mount.sh
1
18.03.2021, 22:56

Теги

Похожие вопросы