#!/bin/bash
#
# Setup automatic cleanup of development servers on boot
# This ensures production services start cleanly
#

echo "Setting up boot-time development server cleanup..."

# Add to user's crontab
(crontab -l 2>/dev/null | grep -v "kill-dev-servers.sh"; echo "@reboot sleep 10 && /media/pts/Website/Church_HOP_MusicData/kill-dev-servers.sh > /tmp/kill-dev-servers.log 2>&1") | crontab -

echo "✓ Added @reboot cron job to kill development servers"

# Verify
echo ""
echo "Current crontab:"
crontab -l | grep -E "(@reboot|kill-dev)"

echo ""
echo "✓ Setup complete!"
echo ""
echo "This will run automatically on every system reboot."
