#!/bin/sh
#<?php die();?>
source /etc/profile
umask 002
cd $(cd "$(dirname "$0")";pwd)
readonly path=$(pwd)/;
readonly pNum=$1;
RunFile="${path}../deBUG/doAsync.sh.run"

function Run(){
	while true
	do
		touch $RunFile
		php ${path}doAsync.php 0
		sleep 1
	done
}

if [[ -f $RunFile ]];then
	Modify=$(date +%s -d "$(stat $RunFile|awk -F'[. ]' '/Modify/{print $2,$3}')");
	Curr=$(date +%s -d $(date +'%H:%M:%S'));
	Timestamp=$(expr $Curr - $Modify);

	if [[ $Timestamp -ge 60 ]];then
		rm -f ${RunFile};
	fi
	exit
fi

Run