php后台服务防止交叉执行
程序员文章站
2022-04-25 10:35:36
...
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
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
sudo chown www:www /alidata/www/office/allocate_order.sh
crontab -e
*/1 * * * * /alidata/www/office/allocate_order.sh
推荐阅读
-
基于AsyncTask进行异步下载(service后台服务执行并可查看下载进度)
-
竟然后台自动执行,这是php5.5的更新吗?
-
关于php执行后台任务解决方法
-
为什么在服务器上php里执行file_put_contents创建文件返回是false呢,文件目录已经设置为777的权限了,不解
-
请教高手php中的EXEC可以执行远程服务器的脚本吗
-
Apache服务器下防止图片盗链的办法,_PHP教程
-
windows服务器下实现php定时执行代码方法_PHP教程
-
请问php实现服务器自动登录网站后台用什么函数
-
php中使用session防止用户非法登录后台的方法
-
防止aspxspy木马列服务 iis信息 执行命令提权等操作