기술메모/unix

Remote IP & port alive check script - netcat

백마탄왕자 2009. 3. 16. 17:29

   

  1. Shell script 작성.

    /home/file/sh/chkalive.sh

     

    #!/bin/ksh

    lines=`exec 2>&1 7>&1; netcat -vtw 10 10.60.8.151 21001 | xargs ;exec 1>&7 7>&-`

    echo [`date +%Y%m%d.%H%M%S`]$lines >> /home/file/log/vpncheck.log

       

     

     

  2. Crontab 등록

    * * * * * /home/file/sh/chkalive.sh 2>&1 > /dev/null

       

    **netcat 있는 UNIX장비에서 사용할 !