1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ]crontabで起動時に自動的にトンネルを掘る

Last updated at Posted at 2019-10-01

crontab

crontabは自動的にスクリプトを実行できるツール
echo '@reboot /path/to/script' | crontab
にスクリプトのパスを書くことで起動時に自動実行してもらえる。
設定は
crontab - lで確認可能で編集したいならcrontab -e で編集できる

実行するスクリプトたち

sshは以下のような感じ

# !/bin/bash
autossh -f -N  hostname

chmodで実行権限を与えておくことを忘れない。

-f -N はバックグラウンドで実行/接続先で何も実行しないというオプション。
起動しているか確認したいときは
ps aux | grep sshで確認するのが手っ取り早い。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?