Files
weval-l99/agent-ethica-countdown.sh
2026-04-20 04:10:40 +02:00

36 lines
866 B
Bash
Executable File

#!/bin/bash
OUT=/var/www/html/api/agent-ethica-countdown.json
NOW=$(date +%s)
Q1_END=$(date -d "2026-03-31" +%s)
DAYS_REMAIN=$(( (Q1_END - NOW) / 86400 ))
[ $DAYS_REMAIN -lt 0 ] && DAYS_REMAIN=0
if [ $DAYS_REMAIN -lt 0 ]; then
URGENCY="OVERDUE"
elif [ $DAYS_REMAIN -lt 7 ]; then
URGENCY="CRITICAL"
elif [ $DAYS_REMAIN -lt 30 ]; then
URGENCY="HIGH"
else
URGENCY="MEDIUM"
fi
cat > $OUT << EOJ
{
"agent": "V61_Ethica_Countdown",
"ts": "$(date -Iseconds)",
"client": "Ethica Group",
"contact": "Kaouther Najar",
"contract": "renewal Q1 2026",
"amount_keur": 280,
"deadline_iso": "2026-03-31",
"days_remaining": $DAYS_REMAIN,
"urgency": "$URGENCY",
"draft_ready_V45": true,
"next_step_owner": "Yacine click send on draft + schedule meeting Kaouther",
"cron": "daily 09:00"
}
EOJ
chown www-data:www-data $OUT 2>/dev/null
cat $OUT