Added example cronjob.
This commit is contained in:
33
run_daily_job.sh
Executable file
33
run_daily_job.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/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.
|
||||||
|
echo "Step 1: Scraping new data..."
|
||||||
|
rstat -c 250
|
||||||
|
|
||||||
|
# 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 ---"
|
Reference in New Issue
Block a user