Files
reddit_stock_analyzer/run_daily_job.sh

35 lines
1003 B
Bash
Executable File

#!/bin/bash
# CRITICAL: Navigate to the project directory using an absolute path.
cd /home/pkhamre/git/rstat
# CRITICAL: Activate the virtual environment using an absolute path.
source /home/pkhamre/git/rstat/.venv/bin/activate
echo "--- Starting RSTAT Daily Job on $(date +%F) ---"
# 1. Scrape data from the last 24 hours and update price for top tickers.
echo "Step 1: Scraping new data..."
rstat --no-financials --comments 256
rstat --update-top-tickers
# 2. Start the dashboard in the background.
echo "Step 2: Starting dashboard in background..."
rstat-dashboard &
DASHBOARD_PID=$!
sleep 10
# 3. Export the overall summary image.
echo "Step 3: Exporting overall summary image..."
python export_image.py --overall
# 4. Post the image to r/rstat.
echo "Step 4: Posting image to Reddit..."
python post_to_reddit.py --target-subreddit rstat
# 5. Clean up by stopping the dashboard server.
echo "Step 5: Stopping dashboard server..."
kill $DASHBOARD_PID
echo "--- RSTAT Daily Job Complete ---"