Files
mql-trading-bots/scripts/setup-cron.sh

28 lines
919 B
Bash
Executable File

#!/bin/bash
# Setup cron job for MQL settings monitoring
echo "Setting up cron job for MQL settings monitoring..."
# Check if python3 is available
if ! command -v python3 &> /dev/null; then
echo "ERROR: python3 not found"
exit 1
fi
# Create cron entry
CRON_CMD="0 */6 * * * cd /home/garfield/mql-trading-bots && python3 scripts/validate-and-notify.py >> /tmp/mql-validate.log 2>&1"
# Add to crontab
(crontab -l 2>/dev/null; echo "$CRON_CMD") | crontab -
echo "Cron job added: Runs every 6 hours"
echo "Logs: /tmp/mql-validate.log"
echo ""
echo "To configure Telegram notifications, set these environment variables:"
echo " export TELEGRAM_BOT_TOKEN='your_bot_token'"
echo " export TELEGRAM_CHAT_ID='your_chat_id'"
echo ""
echo "Add these to your ~/.bashrc to persist:"
echo " echo 'export TELEGRAM_BOT_TOKEN=\"your_token\"' >> ~/.bashrc"
echo " echo 'export TELEGRAM_CHAT_ID=\"your_id\"' >> ~/.bashrc"