Quick command reference for daily operations on Linux (Pop!_OS/Ubuntu).
# 1. Install Python 3.11
sudo apt update
sudo apt install python3.11 python3.11-venv python3.11-dev
# 2. Clone repo
cd ~/repos
git clone <repository-url> instabot
cd instabot
# 3. Create venv
python3.11 -m venv .venv
source .venv/bin/activate
# 4. Install dependencies
pip install -r requirements.txt
# 5. Configure credentials
nano .env
# Add: INSTAGRAM_USER_A, INSTAGRAM_PASS_A, DEVICE
# 6. Setup account structure
chmod +x setup_account_structure.sh
./setup_account_structure.sh
# 7. Install cron jobs
chmod +x install_cron_linux.sh
./install_cron_linux.sh# List devices
adb devices
# Should show: fbc9d1f30eb2 device
# Restart ADB if device not showing
adb kill-server
adb start-server
adb devicescd ~/repos/instabot
source .venv/bin/activate
# Test sessions
python runner.py morning # 45-60 min, ~40 interactions
python runner.py lunch # 45-60 min, ~40 interactions
python runner.py evening # 30-45 min, ~30 interactions
python runner.py extra # 30-45 min, ~25 interactions
# Test strategies
python runner.py growth # Growth strategy
python runner.py cleanup # Unfollow non-mutuals
# Quick test
python test_like.py # 3-8 min test session# Watch cron execution log
tail -f ~/repos/instabot/logs/cron.log
# Watch GramAddict session logs
tail -f ~/repos/instabot/logs/gramaddict_morning.log
tail -f ~/repos/instabot/logs/gramaddict_lunch.log
tail -f ~/repos/instabot/logs/gramaddict_evening.log
# Check recent crashes
ls -lt ~/repos/instabot/crashes/
# Search for errors
grep -i "error\|fail\|blocked" ~/repos/instabot/logs/gramaddict_*.log | tail -20# List installed cron jobs
crontab -l
# Edit cron schedule
crontab -e
# Check cron service status
systemctl status cron
# View system cron logs
journalctl -u cron | tail -30| Time | Session | Duration | Interactions | Days |
|---|---|---|---|---|
| 9:30am | Morning | 45-60 min | ~40 | Daily |
| 1:45pm | Lunch | 45-60 min | ~40 | Daily |
| 3:30pm | Extra | 30-45 min | ~25 | Mon/Wed/Fri |
| 6:15pm | Evening | 30-45 min | ~30 | Daily |
| 11:00pm | Cleanup | 5-10 min | Unfollows | Sunday |
Total Activity:
- 3 sessions/day (Tue/Thu/Sat/Sun): ~110 interactions, 65 likes, 22 follows
- 4 sessions/day (Mon/Wed/Fri): ~135 interactions, 80 likes, 27 follows
- Weekly average: ~150-200 interactions/day
# Check USB connection
adb devices
# Restart ADB
adb kill-server
adb start-server
# Check device authorization
# Look at device screen for "Allow USB Debugging?" prompt# Check cron is running
systemctl status cron
# Check Python path
~/repos/instabot/.venv/bin/python --version
# Should show: Python 3.11.x
# Test command manually
cd ~/repos/instabot && .venv/bin/python runner.py morning# Check Instagram installed
adb -s fbc9d1f30eb2 shell pm list packages | grep instagram
# Launch Instagram manually
adb -s fbc9d1f30eb2 shell am start -n com.instagram.android/.activity.MainTabActivity
# Check Instagram version
adb -s fbc9d1f30eb2 shell dumpsys package com.instagram.android | grep versionName
# Should show: versionName=300.0.0.29.110# Recreate venv with Python 3.11
cd ~/repos/instabot
rm -rf .venv
python3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Verify version
python --version
# Should show: Python 3.11.xcd ~/repos/instabot
./setup_account_structure.sh
# Manually create if needed
mkdir -p accounts/maxhaider.dev
cp accounts/filters.yml accounts/maxhaider.dev/filter.jsonaccounts/
├── maxhaider.dev/
│ └── filter.json # Account-specific filters
├── session_morning.yml # Morning session (Python/Django/FastAPI)
├── session_lunch.yml # Lunch session (Linux/Terraform/CI/CD)
├── session_evening.yml # Evening session (Data/Cloud/AI)
├── session_extra.yml # Extra session (General tech)
├── strategy_growth.yml # Daily growth
├── strategy_cleanup.yml # Weekly cleanup
└── filters.yml # Base filters# Edit session configs
nano ~/repos/instabot/accounts/session_morning.yml
# Update these lines:
# hashtag-likers-top: [your, hashtags, here]
# blogger-post-likers: [competitor1, competitor2, competitor3]# Update .env file
nano ~/repos/instabot/.env
# Update these lines:
# INSTAGRAM_USER_A=maxhaider.dev
# DEVICE=fbc9d1f30eb2
# Or update session configs directly
nano ~/repos/instabot/accounts/session_morning.yml
# Update:
# username: maxhaider.dev
# device: fbc9d1f30eb2# 1. Check device connection
adb devices
# 2. Review error logs
grep -i "error\|blocked" ~/repos/instabot/logs/gramaddict_*.log | tail -20
# 3. Check cron execution
grep "$(date +%Y-%m-%d)" ~/repos/instabot/logs/cron.log
# 4. View session metrics (if metrics_analyzer.py exists)
cd ~/repos/instabot
source .venv/bin/activate
python metrics_analyzer.py maxhaider.dev# Delete logs older than 30 days
find ~/repos/instabot/logs -name "*.log" -mtime +30 -delete
# Delete old crash dumps
find ~/repos/instabot/crashes -name "*.zip" -mtime +30 -delete# Backup important files
cd ~/repos
tar -czf instabot_backup_$(date +%Y%m%d).tar.gz \
instabot/.env \
instabot/accounts/*.yml \
instabot/accounts/maxhaider.dev/
# Restore from backup
tar -xzf instabot_backup_20251205.tar.gz# Comment out all cron jobs
crontab -e
# Add '#' at start of each line
# Or temporarily remove crontab
crontab -r
# Restore from backup
crontab ~/crontab_backup_*.txt# Find process
ps aux | grep gramaddict
# Kill by PID
kill -9 <PID>
# Or kill all Python processes (DANGEROUS - kills everything)
# pkill -9 python# Force stop Instagram
adb -s fbc9d1f30eb2 shell am force-stop com.instagram.android
# Clear app cache (keeps login)
adb -s fbc9d1f30eb2 shell pm clear --cache-only com.instagram.android
# Launch Instagram
adb -s fbc9d1f30eb2 shell am start -n com.instagram.android/.activity.MainTabActivity# Enable "Stay awake" in Developer Options on device
# This prevents screen timeout when charging
# Or via ADB (temporary)
adb -s fbc9d1f30eb2 shell svc power stayon true# Randomize cron times slightly
# Instead of: 30 9 * * *
# Use: 25-35 9 * * * (requires cron with random support)
# Or manually vary times by ±15 minutes each week
crontab -e# Check disk space
df -h ~/repos/instabot
# Check memory
free -h
# Check CPU usage during session
htop
# Look for Python processes| File | Purpose | Location |
|---|---|---|
.env |
Credentials & device ID | ~/repos/instabot/.env |
| Session configs | Bot behavior | ~/repos/instabot/accounts/session_*.yml |
| Filters | Target filtering | ~/repos/instabot/accounts/maxhaider.dev/filter.json |
| Cron log | Cron execution | ~/repos/instabot/logs/cron.log |
| Session logs | Bot activity | ~/repos/instabot/logs/gramaddict_*.log |
| Crashes | Error dumps | ~/repos/instabot/crashes/*.zip |
| Cron schedule | Automation | crontab -l |
- Documentation:
~/repos/instabot/docs/ - Config templates:
~/repos/instabot/config-templates/ - GramAddict docs: https://github.com/GramAddict/bot
- Project README:
~/repos/instabot/README.md - Claude.md:
~/repos/instabot/CLAUDE.md
#!/bin/bash
# Save as: ~/repos/instabot/status.sh
# Usage: ./status.sh
echo "=== Instagram Bot Status ==="
echo ""
echo "Device Connection:"
adb devices | grep -v "List of devices"
echo ""
echo "Python Version:"
~/repos/instabot/.venv/bin/python --version
echo ""
echo "Instagram Version:"
adb -s fbc9d1f30eb2 shell dumpsys package com.instagram.android | grep versionName | head -1
echo ""
echo "Recent Cron Runs:"
tail -5 ~/repos/instabot/logs/cron.log
echo ""
echo "Cron Schedule:"
crontab -l | grep -v "^#" | grep -v "^$"
echo ""Make executable: chmod +x ~/repos/instabot/status.sh
Happy botting! 🤖🚀