🕐 Automatic Draw Setup Guide
📋 Overview: To run draws automatically every 2 days at 10:00 AM IST, you need to set up a cron job that calls the draw script.
Method 1: Server Cron Job (Recommended)
Step 1: Access your server's crontab
crontab -e
Step 2: Add this line to run the draw script every day at 10:00 AM IST
0 10 * * * /usr/bin/php /path/to/your/website/draw.php >/dev/null 2>&1
📝 Note: Replace /path/to/your/website/ with the actual path to your website files. The script will automatically check if it's time for a draw before executing.
Step 3: Save the crontab file and verify it's active
crontab -l
Method 2: Web-based Cron (Alternative)
Step 1: Use a web-based cron service like:
- cron-job.org - Free web cron service
- EasyCron - Free tier available
- SetCronJob - Free web cron
Step 2: Set up the cron job to call this URL every day at 10:00 AM IST:
https://yourdomain.com/draw.php
Step 3: Set the schedule to: 0 10 * * * (daily at 10:00 AM)
Method 3: cPanel Cron Jobs
Step 1: Login to your cPanel
Step 2: Go to "Cron Jobs" under "Advanced" section
Step 3: Create a new cron job with these settings:
- Minute: 0
- Hour: 10
- Day: *
- Month: *
- Weekday: *
- Command:
/usr/bin/php /home/yourusername/public_html/draw.php
🔧 Alternative: Manual Trigger Script
If you can't set up cron jobs, you can create a script that checks and runs draws when someone visits your website:
<?php
// Add this to your index.php or any frequently visited page
require_once 'config.php';
require_once 'draw.php';
if (isDrawTime()) {
// Run draw in background (you might want to use exec() or similar)
$result = conductDraw();
// Optionally log the result
}
?>
📊 Testing Your Setup
Test the draw script directly:
php draw.php
Or visit:
https://yourdomain.com/draw.php?force=1
Check cron job logs:
grep CRON /var/log/syslog
⚠️ Important Notes
- Timezone: Make sure your server timezone is set to IST (Asia/Kolkata)
- PHP Path: Verify the correct PHP path with
which php
- File Permissions: Ensure draw.php has execute permissions
- Database Access: Verify database credentials are correct
🎯 Draw Logic
How it works:
- The cron job runs daily at 10:00 AM IST
- The script checks if it's time for a draw (every 2 days)
- If a draw is due, it selects 10 random winners
- Results are stored in the database
- Next draw is scheduled for 2 days later
📞 Need Help?
If you're having trouble setting up the cron job:
- Contact your hosting provider's support
- Check your hosting control panel documentation
- Use the manual trigger method as a fallback