╔═══════════════════════════════════════════════════════════════════════════════╗ ║ CRON JOB SETUP - QUICK REFERENCE ║ ║ ISP Management System - setupladen.net ║ ╚═══════════════════════════════════════════════════════════════════════════════╝ 📋 QUICK SETUP ═══════════════════════════════════════════════════════════════════════════════ LINUX - AUTO SETUP (RECOMMENDED): chmod +x setup-cron.sh && ./setup-cron.sh LINUX - ONE LINER: (crontab -l 2>/dev/null; echo "* * * * * cd /www/wwwroot/setupladen.net && php artisan schedule:run >> /dev/null 2>&1") | crontab - LINUX - MANUAL: crontab -e # Add this line: * * * * * cd /www/wwwroot/setupladen.net && php artisan schedule:run >> /dev/null 2>&1 ═══════════════════════════════════════════════════════════════════════════════ 🧪 TESTING COMMANDS ═══════════════════════════════════════════════════════════════════════════════ CHECK STATUS: php artisan cron:status php artisan cron:status --check php artisan cron:status --test LIST SCHEDULED TASKS: php artisan schedule:list RUN SCHEDULER MANUALLY: php artisan schedule:run TEST AUTO-ISOLIR (DRY RUN): php artisan pelanggan:auto-isolir --dry-run RUN AUTO-ISOLIR (REAL): php artisan pelanggan:auto-isolir MONITOR WITH SCRIPT: ./monitor-cron.sh ./monitor-cron.sh --full ═══════════════════════════════════════════════════════════════════════════════ 📊 MONITORING ═══════════════════════════════════════════════════════════════════════════════ CHECK CRONTAB: crontab -l VIEW LARAVEL LOGS: tail -f storage/logs/laravel.log VIEW SYSTEM CRON LOGS (Ubuntu): tail -f /var/log/syslog | grep CRON VIEW SYSTEM CRON LOGS (CentOS): tail -f /var/log/cron CHECK CRON SERVICE: systemctl status cron # Ubuntu/Debian systemctl status crond # CentOS/RHEL ═══════════════════════════════════════════════════════════════════════════════ 🔧 CRON SERVICE MANAGEMENT ═══════════════════════════════════════════════════════════════════════════════ START CRON: sudo systemctl start cron # Ubuntu/Debian sudo systemctl start crond # CentOS/RHEL STOP CRON: sudo systemctl stop cron # Ubuntu/Debian sudo systemctl stop crond # CentOS/RHEL RESTART CRON: sudo systemctl restart cron # Ubuntu/Debian sudo systemctl restart crond # CentOS/RHEL ENABLE ON BOOT: sudo systemctl enable cron # Ubuntu/Debian sudo systemctl enable crond # CentOS/RHEL ═══════════════════════════════════════════════════════════════════════════════ 📝 CRONTAB MANAGEMENT ═══════════════════════════════════════════════════════════════════════════════ EDIT CRONTAB: crontab -e VIEW CRONTAB: crontab -l REMOVE CRONTAB: crontab -r BACKUP CRONTAB: crontab -l > crontab_backup_$(date +%Y%m%d).txt RESTORE CRONTAB: crontab crontab_backup_YYYYMMDD.txt ═══════════════════════════════════════════════════════════════════════════════ 🔍 TROUBLESHOOTING ═══════════════════════════════════════════════════════════════════════════════ FIX PERMISSIONS: chmod -R 775 storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cache # Ubuntu chown -R nginx:nginx storage bootstrap/cache # CentOS FIND PHP PATH: which php USE FULL PHP PATH IN CRONTAB: * * * * * cd /www/wwwroot/setupladen.net && /usr/bin/php artisan schedule:run >> /dev/null 2>&1 ENABLE LOGGING IN CRONTAB: * * * * * cd /www/wwwroot/setupladen.net && php artisan schedule:run >> /www/wwwroot/setupladen.net/storage/logs/cron.log 2>&1 ═══════════════════════════════════════════════════════════════════════════════ 🌐 WEB INTERFACE ═══════════════════════════════════════════════════════════════════════════════ CRON MONITOR: https://setupladen.net/pengaturan/cron-monitor AUTO ISOLIR SETTINGS: https://setupladen.net/pengaturan/auto-isolir ═══════════════════════════════════════════════════════════════════════════════ ⏰ CRON EXPRESSION EXAMPLES ═══════════════════════════════════════════════════════════════════════════════ EVERY MINUTE: * * * * * EVERY HOUR: 0 * * * * EVERY DAY AT MIDNIGHT: 0 0 * * * EVERY DAY AT 3:30 AM: 30 3 * * * EVERY SUNDAY AT 2:00 AM: 0 2 * * 0 EVERY MONDAY AT 8:00 AM: 0 8 * * 1 EVERY 6 HOURS: 0 */6 * * * EVERY 15 MINUTES: */15 * * * * ═══════════════════════════════════════════════════════════════════════════════ 📁 PROJECT FILES ═══════════════════════════════════════════════════════════════════════════════ setup-cron.sh - Auto setup script monitor-cron.sh - Monitoring script CRON_SETUP_README.md - Full documentation cron-commands-cheatsheet.txt - This cheatsheet app/Console/Commands/AutoIsolirPelanggan.php - Auto isolir command app/Console/Commands/CronStatus.php - Status command app/Http/Controllers/PengaturanAutoIsolirController.php app/Http/Controllers/CronMonitorController.php - Web monitor resources/views/pengaturan/auto-isolir.blade.php - Auto isolir page resources/views/pengaturan/cron-monitor.blade.php - Monitor page bootstrap/app.php - Schedule definition ═══════════════════════════════════════════════════════════════════════════════ ✅ SETUP CHECKLIST ═══════════════════════════════════════════════════════════════════════════════ [ ] Cron job installed (crontab -l) [ ] Cron service running (systemctl status cron) [ ] Scheduler working (php artisan schedule:run) [ ] Auto isolir enabled (web interface) [ ] Storage permissions OK (chmod -R 775 storage) [ ] Test command works (php artisan pelanggan:auto-isolir --dry-run) [ ] Logs accessible (tail -f storage/logs/laravel.log) [ ] Web monitor accessible (/pengaturan/cron-monitor) ═══════════════════════════════════════════════════════════════════════════════ 📞 SUPPORT WORKFLOW ═══════════════════════════════════════════════════════════════════════════════ 1. Run diagnostic: ./monitor-cron.sh --full 2. Check logs: tail -f storage/logs/laravel.log 3. Test manually: php artisan pelanggan:auto-isolir --dry-run 4. Verify cron: crontab -l 5. Check service: systemctl status cron ═══════════════════════════════════════════════════════════════════════════════ 💡 TIPS ═══════════════════════════════════════════════════════════════════════════════ - Master cron MUST run every minute: * * * * * - Laravel scheduler will manage when each task actually runs - Use --dry-run to test without making changes - Enable logging for debugging (>> /path/to/log.log 2>&1) - Monitor /var/log/syslog for system cron execution - Use absolute paths in crontab for reliability - Set correct timezone in config/app.php ═══════════════════════════════════════════════════════════════════════════════ Created: 2025-11-18 Version: 1.0.0 ═══════════════════════════════════════════════════════════════════════════════