#!/bin/bash

CRONFILE="/var/www/html/ng-crm/uploads/cron/cronjobs.txt"

# Check if the cronfile exists
if [ ! -f "$CRONFILE" ]; then
  echo "Cron file not found: $CRONFILE"
  exit 1
fi

# Update crontab with the contents of the cron file
if sudo crontab -u root "$CRONFILE"; then
  echo "Crontab updated successfully."
else
  echo "Failed to update crontab."
  exit 1
fi