#!/bin/bash
cd /var/www/html/dates || exit 1

LOCK="/tmp/dates_update_channels.lock"
LOG="/var/www/html/dates/data/channels_update.log"

if pgrep -f "/var/www/html/dates/update_channels.php" >/dev/null; then
  echo "$(date) update already running" >> "$LOG"
  exit 0
fi

rm -f "$LOCK"
php -d display_errors=1 /var/www/html/dates/update_channels.php >> "$LOG" 2>&1
