Browse Source

call main bot when docker container start

master
filesite 2 weeks ago
parent
commit
cc661b37f3
  1. 21
      docker-entrypoint.sh
  2. 10
      themes/beauty/controller/CommandController.php

21
docker-entrypoint.sh

@ -13,11 +13,6 @@ if [ -d "/var/www/machete/themes/${theme}/" ]; then @@ -13,11 +13,6 @@ if [ -d "/var/www/machete/themes/${theme}/" ]; then
fi
fi
## 启动samba
if [ -e /usr/sbin/smbd ]; then
echo "Start smbd."
/usr/sbin/smbd -D
fi
## 启动nginx和php-fpm
if [ -e /usr/sbin/nginx ]; then
@ -25,5 +20,17 @@ if [ -e /usr/sbin/nginx ]; then @@ -25,5 +20,17 @@ if [ -e /usr/sbin/nginx ]; then
/usr/sbin/nginx
fi
echo "Start php-fpm."
php-fpm -F
## 启动bot主程序
if [ -e /usr/local/bin/php ]; then
echo "Start main bot."
cd /var/www/machete/
/usr/local/bin/php bin/command.php mainBot &
fi
## 启动php-fpm
if [ -e /usr/local/sbin/php-fpm ]; then
echo "Start php-fpm."
php-fpm -F
fi

10
themes/beauty/controller/CommandController.php

@ -96,10 +96,16 @@ eof; @@ -96,10 +96,16 @@ eof;
//服务器端机器人程序,负责图片、视频文件拍摄时间等信息扫描,并缓存结果供前端使用
public function actionMainBot() {
$thisTime = date('Y-m-d H:i:s');
echo "Main bot started @{$thisTime}\n";
echo "[MainBot] Main bot started @{$thisTime}\n";
exit;
while (true) {
$time = date('Y-m-d H:i:s');
echo "[MainBot] {$time}\n";
sleep(3);
}
}
}

Loading…
Cancel
Save