VNCサーバーの相手先に接続してくれるスクリプト
dig hoge.co.jpの部分に相手先のサーバー名を入れる。
#!/bin/sh
echo ""
echo "choose 1:root or 2:hoge"
echo ""
read ch
echo $ch
case "$ch" in
[1])
echo ""
echo "1: root"
echo ""
#
DATE1=`dig hoge.co.jp | sed '/^$/ d' | grep -v ";" | grep hoge | awk '{print ""$5":1"}'`
#
echo ""
;;
[2])
echo ""
echo "2: hoge"
echo ""
#
DATE1=`dig hoge.co.jp | sed '/^$/ d' | grep -v ";" | grep hoge | awk '{print ""$5":2"}'`
#
echo ""
;;
esac
if [ -z $DATE1 ]
then
echo IP未確認状態
echo ""
#
else
echo IP取得状態
echo ""
echo $DATE1 | awk '{print "/usr/bin/vncviewer "$1""}' > /var/tmp/vnc-start
chmod +x /var/tmp/vnc-start
/var/tmp/vnc-start
rm /var/tmp/vnc-start
fi
Comments