-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcron-job.sh
More file actions
executable file
·22 lines (17 loc) · 856 Bytes
/
Copy pathcron-job.sh
File metadata and controls
executable file
·22 lines (17 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# Example: Nightly cron job with model-router
#
# Uses the cheapest local model by default, falls back to cloud if unavailable.
# Ideal for overnight batch processing where cost matters more than speed.
set -euo pipefail
LOG="/var/log/nightly-analysis.log"
# Try local first (free), fall back to light (cheap cloud)
eval "$(model-router local)" || eval "$(model-router light)"
echo "$(date): Using $MODEL_PROVIDER/$MODEL_ID" >> "$LOG"
# Example: Analyze server logs overnight
# ANALYSIS=$(curl -s http://localhost:11434/api/generate \
# -d "$(jq -n --arg model "$MODEL_ID" \
# --arg prompt "Analyze these logs for anomalies: $(tail -100 /var/log/syslog)" \
# '{model: $model, prompt: $prompt, stream: false}')" \
# | jq -r '.response')
echo "Nightly analysis complete with $MODEL_ID (cost: $MODEL_COST_PER_1K_IN/1K)" >> "$LOG"