#!/bin/bash source /etc/profile tenant_list=`cat /home/web/hy_bash/tenant_app_id` lock_file="/home/web/hy_bash/mutex" CAT_FILE=`cat /home/web/hy_bash/mutex` log_file="/home/web/hy_bash/log" TIME=`/usr/bin/date` # 避免死锁 mutexmtime=`/usr/bin/stat -c %Y /home/web/hy_bash/mutex` now_time=`/usr/bin/date +%s` if [ $[ $now_time - $mutexmtime ] -gt 120 ] then echo 0 > $lock_file exit fi echo "start_time:${TIME}" >> $log_file if [ $CAT_FILE == 1 ] then #echo 锁定状态 echo "lock in use:${TIME}" >> $log_file exit else for tenant_id in $tenant_list do echo 1 > $lock_file #echo $tenant_id: $TIME >> /home/web/hy_bash/aalog cd /home/web/hy_test/public /usr/bin/php index.php pushWaybill $tenant_id done end_time=`/usr/bin/date` echo "end_time:${end_time}" >> $log_file echo 0 > $lock_file fi
shell 脚本执行任务
最新推荐文章于 2024-02-06 16:53:36 发布