Initial commit: Hermes Agent Skills collection
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
# Check real recipe database status and control the mass scraper
|
||||
# Usage: ./check-real-recipes.sh [status|report|start|stop]
|
||||
# status — quick count + log tail
|
||||
# report — count, delta, target met, and whether scraper is running
|
||||
# start — start v4 scraper if below target and not already running
|
||||
# stop — stop any running scraper process
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
LOG="${HOME}/.hermes/profiles/nutrition-coach/scraper.log"
|
||||
OUT="${HOME}/.hermes/profiles/nutrition-coach/scraper_v4.out"
|
||||
DB="${HOME}/.hermes/profiles/nutrition-coach/real_recipes.jsonl"
|
||||
TARGET=25000
|
||||
|
||||
count=$(wc -l < "$DB" 2>/dev/null || echo 0)
|
||||
delta=$((TARGET - count))
|
||||
if [ "$count" -ge "$TARGET" ]; then
|
||||
met="YES"
|
||||
else
|
||||
met="NO"
|
||||
fi
|
||||
pct=$(( count * 100 / TARGET ))
|
||||
is_running=$(pgrep -f chefkoch_scraper_v4.py >/dev/null && echo "yes" || echo "no")
|
||||
|
||||
case "${1:-status}" in
|
||||
status|report)
|
||||
printf "Real recipe DB: %d / %d recipes (%d%%)\n" "$count" "$TARGET" "$pct"
|
||||
printf "Delta: %d | Target met: %s | Scraper running: %s\n" "$delta" "$met" "$is_running"
|
||||
if [ -f "$OUT" ]; then
|
||||
printf "\n--- Scraper out tail ---\n"
|
||||
tail -n 5 "$OUT"
|
||||
fi
|
||||
if [ -f "$LOG" ]; then
|
||||
printf "\n--- Log tail ---\n"
|
||||
tail -n 5 "$LOG"
|
||||
fi
|
||||
;;
|
||||
count)
|
||||
echo "$count"
|
||||
;;
|
||||
start)
|
||||
if [ "$count" -ge "$TARGET" ]; then
|
||||
echo "Target $TARGET already reached."
|
||||
exit 0
|
||||
fi
|
||||
if [ "$is_running" = "yes" ]; then
|
||||
echo "Scraper already running."
|
||||
exit 0
|
||||
fi
|
||||
echo "Starting v4 mass scraper..."
|
||||
cd "${HOME}/.hermes/profiles/nutrition-coach" || exit 1
|
||||
export PYTHONUNBUFFERED=1
|
||||
export PLAYWRIGHT_BROWSERS_PATH="${HOME}/.cache/ms-playwright"
|
||||
nohup python3 scripts/chefkoch_scraper_v4.py --no-agent >> "$OUT" 2>&1 &
|
||||
pid=$!
|
||||
echo "PID: $pid"
|
||||
;;
|
||||
stop)
|
||||
pkill -f chefkoch_scraper_v4.py && echo "Stopped scraper" || echo "Scraper not running"
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Start Chefkoch Scraper v4 safely as background daemon
|
||||
# Place this in ~/.hermes/scripts/ and chmod +x
|
||||
LOG="/home/debian/.hermes/profiles/nutrition-coach/scraper_v4.out"
|
||||
PIDFILE="/tmp/chefkoch_scraper_v4.pid"
|
||||
|
||||
# Check if already running
|
||||
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
|
||||
echo "Scraper already running (PID $(cat $PIDFILE))"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd /home/debian/.hermes/profiles/nutrition-coach || exit 1
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
export PLAYWRIGHT_BROWSERS_PATH=/home/debian/.cache/ms-playwright
|
||||
|
||||
nohup python3 /home/debian/.hermes/scripts/chefkoch_scraper_v4.py > "$LOG" 2>&1 &
|
||||
PID=$!
|
||||
echo $PID > "$PIDFILE"
|
||||
echo "Scraper started (PID $PID). Log: $LOG"
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# Start Chefkoch Scraper v4 safely using profile .venv + profile-local fixed script
|
||||
# Place in ~/.hermes/scripts/ and chmod +x
|
||||
LOG="/home/debian/.hermes/profiles/nutrition-coach/scraper_v4.out"
|
||||
PIDFILE="/tmp/chefkoch_scraper_v4.pid"
|
||||
|
||||
# Check if already running
|
||||
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
|
||||
echo "Scraper already running (PID $(cat $PIDFILE))"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd /home/debian/.hermes/profiles/nutrition-coach || exit 1
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
export PLAYWRIGHT_BROWSERS_PATH=/home/debian/.cache/ms-playwright
|
||||
|
||||
nohup /home/debian/.hermes/profiles/nutrition-coach/.venv/bin/python3 \
|
||||
/home/debian/.hermes/profiles/nutrition-coach/scripts/chefkoch_scraper_v4.py \
|
||||
--no-agent >> "$LOG" 2>&1 &
|
||||
PID=$!
|
||||
echo $PID > "$PIDFILE"
|
||||
echo "Scraper started (PID $PID). Log: $LOG"
|
||||
Reference in New Issue
Block a user