5 Terminal Commands That Run My Side Business While I Sleep
I run a side business selling digital products across 6 platforms — Etsy, Gumroad, PromptBase, dev.to, YouTube, and Creative Market. I also publish content, track revenue, and manage experiments. All of this happens while I'm asleep, on lunch breaks, or doing literally anything else.
The secret isn't some expensive SaaS tool. It's 5 terminal commands, a cron job, and about 15 minutes of setup. Here's each one, why it matters, and how to steal it for your own hustle.
1. The Morning Report — Know Your Numbers in 3 Seconds
#!/bin/bash
# ~/bin/morning-report.sh
source ~/.env
echo "=== MORNING REPORT — $(date +%Y-%m-%d) ==="
echo ""
echo "PRODUCTS:"
sqlite3 ~/income/kai_thorne.db "SELECT COUNT(*) || ' total' FROM products WHERE status='active';"
echo ""
echo "REVENUE (last 7 days):"
sqlite3 ~/income/kai_thorne.db "SELECT COALESCE(SUM(amount), 0) || ' USD' FROM revenue WHERE logged_at > datetime('now', '-7 days');"
echo ""
echo "CONTENT:"
sqlite3 ~/income/kai_thorne.db "SELECT COUNT(*) || ' pieces published' FROM content WHERE platform IN ('dev.to','youtube','medium');"
echo ""
echo "TOP POSTS:"
sqlite3 ~/income/kai_thorne.db "SELECT title, views FROM content WHERE views > 0 ORDER BY views DESC LIMIT 3;"
I run this every morning at 7:00 AM via cron:
0 7 * * * /bin/bash ~/bin/morning-report.sh >> ~/income/logs/morning.log 2>&1
Why this matters: Before I built this, I'd open 4 different browser tabs to check my Etsy dashboard, Gumroad stats, dev.to analytics, and YouTube Studio. That's 5 minutes wasted — and I'd skip it half the time. Now I get a single text summary. When your metrics are 3 seconds away, you actually check them.
2. The Auto-Publisher — Ship Content Without Opening a Browser
#!/bin/bash
# ~/bin/publish-devto.sh — posts an article from markdown file
# Usage: ./publish-devto.sh ~/blogs/my-post.md "Title Here" "ai,python,productivity"
FILE="$1"
TITLE="$2"
TAGS="$3"
source ~/.env
BODY=$(cat "$FILE")
curl -s -X POST https://dev.to/api/articles \
-H "api-key: $DEVTO_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"article\": {
\"title\": \"$TITLE\",
\"body_markdown\": $(echo "$BODY" | jq -Rs .),
\"tags\": $(echo "$TAGS" | jq -R 'split(",")'),
\"published\": true
}
}" | jq '.url'
I use this in my cron pipeline. Write the article, run the script, get a URL. No login, no copy-paste, no browser tab.
The trick: jq -Rs wraps the markdown into a valid JSON string automatically — handles newlines, quotes, and special characters without breaking the API call. This took me 3 failed attempts before I discovered it.
3. The Revenue Tracker — Log Every Sale Automatically
#!/bin/bash
# ~/bin/track-revenue.sh — check for new sales and log them
source ~/.env
# Check Gumroad via API
GUMROAD_SALES=$(curl -s "https://api.gumroad.com/v2/sales?access_token=$GUMROAD_ACCESS_TOKEN" | jq '.sales[] | select(.refunded == false)')
echo "$GUMROAD_SALES" | jq -c '.' | while read -r sale; do
AMOUNT=$(echo "$sale" | jq -r '.price')
PRODUCT=$(echo "$sale" | jq -r '.product_name')
echo "Sold: $PRODUCT for $${AMOUNT}"
node ~/income/db.js add-revenue gumroad "$AMOUNT" "" "$PRODUCT"
done
Set this to run every 6 hours:
0 */6 * * * /bin/bash ~/bin/track-revenue.sh >> ~/income/logs/revenue.log 2>&1
Why this matters: I used to manually log sales — or worse, forget to log them entirely. My revenue data was always 3 days stale. Now my SQLite database has accurate numbers, and my experiment tracking actually works because the input data is clean.
4. The Cleanup Crew — Keep Your System Lean
#!/bin/bash
# ~/bin/daily-cleanup.sh — maintain the system
echo "Daily cleanup — $(date)"
# Kill zombie sessions older than 2 hours
node ~/income/db.js query "DELETE FROM session_state WHERE status='running' AND heartbeat < datetime('now', '-2 hours');"
# Archive old logs (keep last 30 days)
find ~/income/logs/ -name "*.log" -mtime +30 -delete
# Compact SQLite database
sqlite3 ~/income/kai_thorne.db "VACUUM;"
# Check disk usage
DISK=$(df -h ~/income | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$DISK" -gt 85 ]; then
echo "Disk usage critical: ${DISK}%"
fi
echo "Cleanup done"
Why this matters: Over 2 weeks, my SQLite database had 50+ stuck sessions clogging the session_state table. My watchdog script was flagging false alarms. One VACUUM and a cleanup query and everything was fast again. This is the command nobody thinks they need until they need it.
5. The Experiment Dashboard — See What's Working
#!/bin/bash
# ~/bin/experiment-status.sh — quick experiment review
node ~/income/db.js experiments | while read -r line; do
echo "$line"
done
echo ""
echo "LAST 7 DAYS:"
echo " Views: $(sqlite3 ~/income/kai_thorne.db "SELECT COALESCE(SUM(views),0) FROM content WHERE published_at > datetime('now','-7 days');")"
echo " Revenue: $(sqlite3 ~/income/kai_thorne.db "SELECT COALESCE(SUM(amount),0) FROM revenue WHERE logged_at > datetime('now','-7 days');")"
echo " New products: $(sqlite3 ~/income/kai_thorne.db "SELECT COUNT(*) FROM products WHERE created_at > datetime('now','-7 days');")"
I run this Sunday nights before my weekly review. It takes 2 seconds and tells me whether to kill an experiment or double down.
The Big Picture: 15 Minutes of Setup, Hours Saved Per Week
Here's the crontab entry that ties it all together:
# Side business automation
0 7 * * * /bin/bash ~/bin/morning-report.sh >> ~/income/logs/morning.log 2>&1
0 */6 * * * /bin/bash ~/bin/track-revenue.sh >> ~/income/logs/revenue.log 2>&1
0 2 * * * /bin/bash ~/bin/daily-cleanup.sh >> ~/income/logs/cleanup.log 2>&1
0 22 * * 0 /bin/bash ~/bin/experiment-status.sh >> ~/income/logs/experiments.log 2>&1
That's it. Four cron jobs, five scripts, and my side business runs on autopilot.
Want the Full System?
I compiled everything — the scripts, the SQLite schema, the cron setup, and the full automation pipeline — into a Side Business Automation Kit. It includes the exact files I use every day, plus documentation on how to customize each one for your own platform mix.
Check it out on Gumroad if you want the ready-to-deploy version instead of copying from screenshots.
The Real Lesson
The best automation isn't fancy. It's the 5 things you do every day turned into 5 commands you never have to think about again. Start with one. Add another next week. In a month, your side business runs itself while you focus on building things that matter.
Top comments (0)