wireless.sh

来源:互联网 发布:风靡网络 编辑:程序博客网 时间:2024/06/09 21:12

#!/bin/bash
#
# 无线起停脚本
###############################################################################
# Owner by Carter Peng 2011-03-29

#

function testcontent() {
    char=`basename $1`
#     echo ${char##*.}
    if [ ${char##*.} = "php" ];
    then
    return 1
    else
    return 0
    fi
}

case $1 in
    "start")
                echo "Start the customized scripts..."

                ############### 163 ########################
                # 无线后台业务相关的gearman worker脚本:
                nohup php cbn_business_retreat.php &
                nohup php cbn_business_transition.php &
                nohup php cbn_bussiness_changed.php &
                nohup php cbn_charge_business_pointcard.php &
                nohup php cbn_charge_business_sms.php &
                nohup php cbn_charge_business_tryout.php &
                nohup php cbn_chargedcolumn_expired.php &
                nohup php cbn_delete_appversion.php &
                nohup php cbn_expirationdate_extend.php &

                # ipad后台相关的gearman worker脚本:
                nohup php ipad_node_comment.php &
                nohup php ipad_node_up.php &

                # MTK后台业务资费相关:
                nohup python cbn_send_message_dianbo.py &
                nohup python cbn_send_message_baoyue.py &


                ############### 164 ########################
                # redis缓存清理:
                nohup php clear_cache.php &
               
                #日志处理:
                nohup python logfilebatchhandler.py &
                nohup python mobilelogging.py &
                nohup python errordispatcher.py &
               
                # 静态化相关脚本:
                nohup php staticIpadList.php &
                nohup php staticDetailQueue.php &
                nohup php staticKalturaList.php &
                nohup php staticMTKList.php &
                nohup php staticIphoneList.php &
                nohup php deploy_appv_list.php &
                nohup php staticStockList.php &
                nohup python ranklistgenerator.py &

                # MTK后台业务资费相关:
                nohup python phonenumberbinder.py &
                nohup python spcharger.py &

                echo "Customized scripts started."
                ;;

         "test")
                echo "Start the customized scripts..."

                nohup /opt/lampp/bin/php /opt/lampp/htdocs/test.php &
                nohup /opt/lampp/bin/php /opt/lampp/htdocs/test1.php &
                nohup /opt/lampp/bin/php /opt/lampp/htdocs/test2.php &
                nohup /opt/lampp/bin/php /opt/lampp/htdocs/test3.php &
                nohup python /opt/lampp/htdocs/test5.py &

                echo "Customized scripts started."
 
                ;;

         "stop")
                echo "Stop the customized scripts..."

                kill -9 $(pgrep -f php)
                kill -9 $(pgrep -f cbn_send_message_dianbo.py)
                kill -9 $(pgrep -f cbn_send_message_baoyue.py)
                kill -9 $(pgrep -f logfilebatchhandler.py)
                kill -9 $(pgrep -f mobilelogging.py)
                kill -9 $(pgrep -f errordispatcher.py)
                kill -9 $(pgrep -f ranklistgenerator.py)
                kill -9 $(pgrep -f phonenumberbinder.py)
                kill -9 $(pgrep -f spcharger.py)

                echo "Customized scripts stoped."
                ;;

         "restart")
                $0 stop
                sleep 4
                $0 test
                ;;

         "startone")
                if testcontent $2
                then
                    nohup python $2 &
                else
                    nohup /opt/lampp/bin/php $2 &
                fi
                ;;

         "stopone")

                ;;

         *)
                echo "Usage: $0 <action> [scriptname]"
                echo ""
                echo "  start     Start the customized scripts"
                echo "  startone  Start one customized script alone"
                echo "  stop      Stop the customized scripts"
                echo "  restart   Restart the customized scripts"
                echo ""
                ;;
esac