#!/bin/bash

# This file is part of the SiteOne Crawler.
#
# (c) Ján Regeš <jan.reges@siteone.cz>

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

if [[ ! -x "$DIR/bin/swoole-cli" ]]; then
  echo "Error: bin/swoole-cli script not found or not executable."
  exit 1
fi

cd "$DIR"

./bin/swoole-cli "src/crawler.php" "$@"

exit_code=$?
cd - > /dev/null
exit $exit_code
