Browse Source

spider watcher improved

master
filesite 2 days ago
parent
commit
8d869187d8
  1. 20
      spider_watcher.sh
  2. 1
      start_cloud_in_container.sh

20
spider_watcher.sh

@ -1,6 +1,10 @@
#!/bin/sh #!/bin/sh
## spider watcher, work with start_cloud_in_container.sh ## spider watcher, work with start_cloud_in_container.sh
## 如果遇到chrome因为开启了sandbox而启动报错,提示需要修改chrome/xx.xx.xx.xx版本所有者为root且权限改为4755
## 则手动修改/app/ulixee/node_modules/@ulixee/hero-core/.env.defaults
## 把ULX_NO_CHROME_SANDBOX=# don't force the chrome sandbox设置为ULX_NO_CHROME_SANDBOX=yes,关闭sandbox
script_root=$(dirname $0) script_root=$(dirname $0)
cd $script_root cd $script_root
@ -12,17 +16,23 @@ watcher()
echo "Spider is down, try to restart it." echo "Spider is down, try to restart it."
echo "Checking ulixee cloud" echo "Checking ulixee cloud"
cloud_num=`docker ps | grep 'Up ' | grep -v grep | wc -l` cloud_num=`docker ps | grep 'ulixee_cloud' | grep -v grep | wc -l`
if [ $cloud_num -ge 1 ]; then if [ $cloud_num -ge 1 ]; then
echo "ulixee cloud is alive, start spider" echo "ulixee cloud is alive, start spider"
cd $script_root cd $script_root
npm start -- config_custom.json npm start -- config_custom.json
else else
echo "ulixee cloud is down, try to restart it" echo "ulixee cloud is down, try to restart it"
docker stop ulixee_cloud cloud_installed=`docker ps -a | grep 'ulixee_cloud' | grep -v grep | wc -l`
docker rm ulixee_cloud if [ $cloud_installed -e 1 ]; then
cd $script_root docker start ulixee_cloud
./start_cloud_in_container.sh else
docker stop ulixee_cloud
docker rm ulixee_cloud
cd $script_root
./start_cloud_in_container.sh
fi
sleep 10 sleep 10
fi fi

1
start_cloud_in_container.sh

@ -26,6 +26,7 @@ chmod 777 $DATADIR_MOUNT
docker run -itd --init \ docker run -itd --init \
--name ulixee_cloud \ --name ulixee_cloud \
--ipc=host \ --ipc=host \
--user ulixee \
--restart unless-stopped \ --restart unless-stopped \
--sysctl net.ipv4.tcp_keepalive_intvl=10 \ --sysctl net.ipv4.tcp_keepalive_intvl=10 \
--sysctl net.ipv4.tcp_keepalive_probes=3 \ --sysctl net.ipv4.tcp_keepalive_probes=3 \

Loading…
Cancel
Save