带动态链接库的启动脚本

#!/bin/sh

path_current=`pwd`
path_script=$(cd "$(dirname "$0")"; pwd)
mode=$1

exe_name=NetSpeedServer

export PATH=$PATH:$path_script
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$path_script

app_process=`ps -ef | grep "$exe_name"| grep -v grep`

case "$mode" in
   'start')
        echo "it's ready to start op...."
        if test -n "$app_process"; then
                echo ""
                echo "$app_process"
                echo ""
        else
		cd $path_script
                nohup $path_script/$exe_name host=39.105.7.201 port=9513 > /dev/null 2>&1 &
		cd $path_current

        fi

        echo 'success to start.'
        ;;
   'stop')
        echo "it's ready to check process..."
        if test -n "$app_process"; then
                echo "had find app process informaton"
                echo $app_process | awk '{print ($2)}' | xargs kill -9
        fi
        echo 'success to kill.'
        ;;
    *)
        basename=`basename "$0"`
        echo "Usage: $basename  {start|stop}  [ server options ]"
        exit 1
        ;;
esac
exit 1