Files
html/api/sc.php
2026-04-12 22:57:03 +02:00

14 lines
593 B
PHP

<?php
if(($_GET['k']??'')!=='WEVADS2026') die('auth');
// Add Scrapy site_monitor to cron (every 6h)
$cron="/var/spool/cron/crontabs/www-data";
$c=file_get_contents($cron);
if(strpos($c,"scrapy-api")===false){
$c.="\n# Scrapy site monitor - every 6h\n0 */6 * * * curl -s http://localhost/api/scrapy-api.php?k=WEVADS2026\\&action=run\\&spider=site_monitor > /dev/null 2>&1\n";
file_put_contents($cron,$c);
exec("service cron reload 2>&1");
echo json_encode(["ok"=>true,"added"=>"scrapy cron every 6h"]);
} else {
echo json_encode(["ok"=>true,"status"=>"already exists"]);
}