DEV Community

Mustafa ERBAY
Mustafa ERBAY

Posted on • Originally published at mustafaerbay.com.tr

Morning Routine for the Pragmatic Engineer: Discipline or Flexibility?

Every time I see productivity gurus online advising, "Wake up at 5 AM, take a cold shower, meditate for 2 hours, then look at your vision board," I can't help but chuckle. After 20 years in this industry, writing code, keeping servers online, and having my sleep interrupted by disk full alarms at midnight, I can tell you: these theories don't work in real life, especially in our profession. If PostgreSQL WAL bloat caused replication to fail at 03:14 AM and you only got to bed at 04:30 AM, waking up at 05:00 AM for a cold shower won't make you a disciplined engineer; it will just make you a sleep-deprived, inefficient, and error-prone one.

For me, a morning routine isn't about waking up robotically at the same time every day with military discipline. It's a pragmatic "uptime" management that can flex according to the needs of the system and my own biology. In this post, I'll share my approach to starting the day, the tools I use, and how I make my decisions, based on my own experiences.


A System Administrator's Biological Clock: Cron Jobs vs. Event-Driven Triggers

For years, I tried to force myself to be a morning person. There was a period when I believed the myth that "successful people wake up early" and set my alarm for 06:00 AM every day. The result? The quality of code I wrote during the day decreased, I started making simple mistakes in Nginx configurations, and worse, my brain completely shut down after 4:00 PM. Then I realized that trying to run human biology like a fixed cron job is akin to designing a system architecture that lacks flexibility.

Instead, I started approaching my day with an "event-driven" mindset. If there was no live deployment of the production ERP or a database migration the previous night, waking up at 08:00 AM after getting enough sleep is the most efficient trigger for me. However, if there was an incident during the night, I need to extend my wake-up time and recharge my biological battery.

# The inefficient "Fixed Cron" model I forced myself into (Not recommended)
00 06 * * * /usr/bin/wake_up --force-cold-shower --ignore-sleep-debt

# My realistic and sustainable "Event-Driven" model
@reboot /usr/bin/evaluate_sleep_quality.sh && /usr/bin/start_day.sh
Enter fullscreen mode Exit fullscreen mode

What matters for a real engineer isn't when they wake up, but the quality of focus in the first few hours after waking. If I start the day with 40% battery, the technical debt from the code I write that day will come back to haunt me as more overtime later. As I wrote before about [related: technical debt management], decisions made in haste and with a tired mind always come at a higher cost.


The First 2 Hours Rule: Log Analysis, Code, or Just Coffee?

Opening the computer and immediately reading emails or Slack messages means surrendering to someone else's agenda. I completely disconnect from the outside world for the first 2 hours. During this time, I don't check my phone or open corporate communication channels. I divide this time into two: the first 30 minutes to check the general status of the systems, and the remaining 90 minutes for tasks requiring deep focus.

The first thing I do after starting my day is read a summary report showing the status of critical servers and services, using a small bash script I wrote myself. I call this my "morning visit."

=== SYSTEM HEALTH REPORT - 2026-06-01 08:15 ===
[OK] PostgreSQL Master: Connection count: 42/500, WAL write lag: 0 MB
[OK] Redis Cache: Memory usage: 1.2 GB / 4.0 GB (OOM Policy: volatile-lru)
[WARN] Nginx Reverse Proxy: 5xx Error Rate: %0.04 (12 x 502 errors in the last 1 hour)
[OK] Background Workers: Active systemd units: 8/8 running
================================================
Enter fullscreen mode Exit fullscreen mode

After reviewing this report and ensuring the systems are stable, I grab my coffee and focus on the most challenging task. This could be prompt optimization for an AI model, index analysis of a complex SQL query, or native bridge integration for a mobile application. Spending these first few hours, when the brain is at its sharpest, replying to emails is a terrible waste of resources.

💡 Reduce Decision Fatigue

Thinking "What should I do today?" right after waking up is a huge energy drain. Write down the top 3 most important technical tasks for the next day in a simple markdown file on your terminal the evening before. In the morning, just open that file and start working.


The Limits of Flexibility: How Morning Routines Get Shattered After "On-Call" Nights

In theory, everything might sound great, but a system administrator's life doesn't always go as planned. Last month, at 02:40 AM, I received a memory leak alarm on the backend server of a side project I developed. The server's cgroup limits (memory.high) kicked in, and containers started restarting one after another.

That night, I spent until 05:00 AM analyzing logs, found the issue was due to the Redis connection pool not being closed properly, and deployed the fix. Now, trying to go for a 10-kilometer run at 08:00 AM in the name of "discipline" after such a night is madness.

// One of the critical error logs I received that night
{
  "timestamp": "2026-05-12T02:41:03.112Z",
  "level": "FATAL",
  "message": "Out of memory: Killed process 14285 (python3) total-vm:4194304kB, anon-rss:2097152kB",
  "cgroup": "docker/backend"
}
Enter fullscreen mode Exit fullscreen mode

In such situations, my "State of Emergency (SOE) Protocol" kicks in:

  1. Delayed Start: I push my wake-up time back by at least 2 hours.
  2. Zero Meetings: I cancel all synchronous meetings for the day or convert them to asynchronous communication.
  3. Low Cognitive Load: Instead of designing a new architecture that day, I only perform routine log monitoring, documentation updates, or simple refactoring tasks.

This flexibility isn't a privilege I grant myself; it's a necessary decision for the system's sustainability. An engineer who burns themselves out is the most likely to make mistakes in a production environment.


Automating Routines: Scripts That Reduce Morning Decision Fatigue

A pragmatic engineer tends to automate every repetitive task. Instead of individually thinking about which websites to check or which logs to monitor in the morning, I have a small automation script that runs every morning when I turn on my computer.

This script opens the necessary terminal tabs for me, checks the status of Docker containers, and brings up my local development environment.

# ~/bin/morning_spinup.py
import subprocess
import os

def check_local_env():
    print("[*] Checking local services...")
    # Start Docker Compose services
    subprocess.run(["docker", "compose", "-f", "/home/mustafa/projects/docker-compose.yml", "up", "-d"])

    # Test PostgreSQL connection
    pg_status = subprocess.run(["pg_isready", "-h", "localhost", "-p", "5432"], capture_output=True, text=True)
    if "accepting connections" in pg_status.stdout:
        print("[OK] PostgreSQL is ready.")
    else:
        print("[ERROR] Failed to start PostgreSQL!")

def open_workspaces():
    print("[*] Opening development environments...")
    # Open frequently used project directories with VS Code
    os.system("code /home/mustafa/projects/production-erp")
    os.system("code /home/mustafa/projects/my-side-project")

if __name__ == "__main__":
    check_local_env()
    open_workspaces()
    print("[SUCCESS] Morning work environment is ready. Happy coding, Mustafa.")
Enter fullscreen mode Exit fullscreen mode

With this script, I save 15-20 minutes and, more importantly, mental energy that I would otherwise spend sitting down at the computer and thinking, "Where did I leave off on which project? Are the services up?" I turn on the computer, run the script, grab my coffee, and come back to find everything ready and waiting for me.

As I mentioned before regarding [related: developer productivity], automation is our most powerful weapon not just for managing servers but also for managing our own daily operations.


The Pragmatic Engineer's Balance: My Weekly "Uptime" Table

I enjoy monitoring my own life like a system. Of course, I'm not obsessive enough to track every day's metrics, but I do have some "SLA" (Service Level Agreement) values that I set for myself on a weekly basis. The table below shows the pragmatic goals I use to balance my quality of life and work productivity.

Metric (SLA) Target Rate Actual (Average) Tolerable Deviation Explanation
Sleep Quality (7+ hours) %85 %80 %15 (Incident nights) Non-negotiable threshold for mental clarity.
Deep Work (Focused Work) 15 Hours/Week 12 Hours -3 Hours (Meeting density) Total of the first 2-hour blocks in the morning.
Screen-Free Time (Digital Detox) 2 Hours/Day 1.5 Hours -30 Minutes Mandatory for eye and mental health.
Physical Activity 3 Days/Week 2 Days -1 Day (Intense deploy week) Usually evening walks or stretching.

If my sleep SLA value drops below 70% for two consecutive weeks, it means there's a "memory leak" in the system. I immediately review my workload, freeze new features, and put myself into maintenance. It's like putting a server into maintenance mode.


My Clear Stance: Discipline is a Tool, Flexibility is a Survival Skill

My clear stance on morning routines is this: Discipline is valuable as long as it enables flexibility. Confining yourself blindly to rigid military discipline is no different from designing a fragile software architecture that cannot adapt to changing conditions.

A truly pragmatic engineer knows when to work hard, when to rest, when to stay up all night in the server room, and when to turn off the morning alarm and sleep in. Understand your own biology and the dynamics of your work. Instead of copying others' morning routines, develop a flexible and sustainable routine that suits your own "uptime" requirements.

In my next post, I will cover another interesting incident analysis from production environments. See you then.

Top comments (0)