1
0

start_batch_ingest.sh 1.2 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Local Food AI - Disconnected Ingestion Wrapper
  3. # This script uses nohup to run the python ingestion script in the background.
  4. # You can exit your SSH session safely after starting this script.
  5. echo "========================================================="
  6. echo "🍔 Local Food AI: Extreme Batch Ingestion"
  7. echo "========================================================="
  8. if [ ! -f "en.openfoodfacts.org.products.csv" ] && [ ! -f "fr.openfoodfacts.org.products.csv" ]; then
  9. echo "❌ Error: CSV files not found in the current directory."
  10. echo "Please download the massive CSVs before running this batch."
  11. exit 1
  12. fi
  13. echo "🚀 Starting database wipe and reset..."
  14. # Automatically run the new DB setup to drop the rigid table
  15. venv/bin/python3 setup_db.py
  16. echo "🚀 Triggering background ingestion process via nohup..."
  17. echo "All outputs will be saved to ingestion_process.log"
  18. # Run securely in background
  19. nohup venv/bin/python3 -u ingest_csv.py > ingestion_process.log 2>&1 &
  20. BG_PID=$!
  21. echo "✅ Process started in the background (PID: $BG_PID)"
  22. echo "You can now safely close your terminal or turn off your computer."
  23. echo "To monitor progress from the server later, run:"
  24. echo " tail -f ingestion_process.log"