#!/bin/bash
phpPath='/usr/local/php/bin/php'
autoPath='/home/webcode/export/zhwms/branches/auto/'
logPath='/home/webcode/export/zhwms/branches/data/log/'
fileName=$1
num=`ps aux | grep ${autoPath}${fileName}.php | grep -v grep | wc -l`
if [[ $num -gt 0 ]];then
        echo "${fileName} proccess is running"
        exit
else
        lockfile="${logPath}${fileName}.lock"
                if [[ ! -f "$lockfile" ]];then
                        ${phpPath} ${autoPath}${fileName}.php >> ${logPath}${fileName}.log
                else
                        rm -f $lockfile
                        ${phpPath} ${autoPath}${fileName}.php >> ${logPath}${fileName}.log
                fi
fi
exit 0
