Rumah > pembangunan bahagian belakang > tutorial php > php后台服务防止交叉执行

php后台服务防止交叉执行

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Lepaskan: 2016-06-23 13:10:29
asal
1155 orang telah melayarinya

sudo mkdir /alidata/www/office/orderlog/
sudo chown www:www /alidata/www/office/orderlog/ -R
sudo chmod 777 /alidata/www/office/orderlog/ -R
sudo vim /alidata/www/office/allocate_order.sh

#!/bin/bashcount=`ps aux|grep 'hh/auto-process-order'|grep -v 'grep'|wc -l`if [ 0 == ${count} ];then        orderlog_dir=/alidata/www/office/orderlog/`date +%y%m%d`/        orderlog_file=${orderlog_dir}`date +%H`        if [ ! -d ${orderlog_dir} ]; then                mkdir -p ${orderlog_dir}        fi        if [ ! -f ${orderlog_file} ]; then                touch ${orderlog_file}        fi        /alidata/server/php/bin/php /alidata/www/office/yii hh/auto-process-order >> ${orderlog_file}fi
Salin selepas log masuk

sudo chown www:www /alidata/www/office/allocate_order.sh


crontab -e
*/1 * * * * /alidata/www/office/allocate_order.sh

Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan