#!/bin/bash
# Register plugin with Unraid's cron system and rebuild cron entries after every boot.
# /var/log/plugins/ and /etc/cron.d/ are RAM-based and wiped on reboot.
cp /boot/config/plugins/varaverk.plg /var/log/plugins/varaverk.plg 2>/dev/null
php -r "
require_once '/usr/local/emhttp/plugins/varaverk/include/scheduler.php';
\$schedule = vv_schedule_load();
if (\$schedule) vv_cron_rebuild(\$schedule);
" 2>>/var/log/varaverk/rebuild_cron.log
