sshとcron

Backupを取得するに際して、Backupを元々のServerに置いておいたら、Disk破損の時に一気に死ぬ。 で、そんな事態は救われないので、BackupをRemoteに置いておくために、Backup Scriptまで作ったわけだが、Serverの内側でcronなどでBackupを取得するのは設定ミスとか管理の分散とかが起こってうれしくない。 というわけで、remoteからsshを利用してBackupを取得するようにscriptを作ったのだが、

Pseudo-terminal will not be allocated because stdin is not a terminal.

などといいうErrorが出た。で、これはptyの割り付けないremoteからのコマンドは実行できないということでsshが吐き出すErrorである。

しかし、shell scriptには-tは記載されていて、ちゃんと動くはずだとどはまりをしたわけで…

で、困りに困って調べてみたら、出てました。man ssh

 -t      Force pseudo-tty allocation.  This can be used to execute arbitrary screen-based pro-
         grams on a remote machine, which can be very useful, e.g. when implementing menu ser-
         vices.  Multiple -t options force tty allocation, even if ssh has no local tty.

よく見たら、Multiple -t options force tty allocation, even if ssh has no local tty.だそうな。

要するに、-t -tとしろと。

わかりにくいからメモにしておく。

教訓は、RTFM … orz.