matengfei吧 关注:1贴子:163
  • 1回复贴,共1


IP属地:北京1楼2014-05-07 18:32回复
    shell 脚本模版
    #!/bin/bash
    #var define
    DnsCapDir1="/DnsCap"
    DnsCapDir2="/mnt/RAMFS"
    DnsCapEXE=./DnsCap
    DnsCapOutput=DnsCap.log
    NRSendClientEXE=./NRSendClient
    NRSendClientOutput=NRSendClient.log
    ReadIPEXE=./ReadIP
    WebInfoEXE=./WebInfo
    #DnsCap configure fun
    function DnsCap
    {
    #mast cd DnsCap exec the DnsCap
    cd ./DnsCap/
    #create /DnsCap Dir
    if [ ! -d "$DnsCapDir1" ] ; then
    mkdir "$DnsCapDir1"
    echo "mkdir $DnsCapDir1"
    fi
    #create /mnt/RAMFS Dir
    if [ ! -d "$DnsCapDir2" ] ; then
    mkdir "$DnsCapDir2"
    echo "touch $DnsCapDir2"
    fi
    #check DnsCap is exits
    if [ ! -e "$DnsCapEXE" ] ; then
    echo "DnsCap is not exits"
    cd ../
    exit
    fi
    #chmod DnsCap to exec
    if [ ! -x "$DnsCapEXE" ] ; then
    chmod 777 $DnsCapEXE
    fi
    #start DnsCap service
    state=$(pgrep DnsCap)
    if [ ! -z $state ] ; then
    echo 'DnsCap already start'
    else
    ($DnsCapEXE > $DnsCapOutput)&
    echo "start DnsCap service"
    fi
    cd ../
    }


    IP属地:北京3楼2014-05-08 16:48
    回复