<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Isaac Ntumpi</title>
    <description>The latest articles on DEV Community by Isaac Ntumpi (@isaac_ntumpi).</description>
    <link>https://dev.to/isaac_ntumpi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3165498%2F8c55e0db-b438-488e-b9a8-61554831316f.png</url>
      <title>DEV Community: Isaac Ntumpi</title>
      <link>https://dev.to/isaac_ntumpi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/isaac_ntumpi"/>
    <language>en</language>
    <item>
      <title>Your Linux Server (Debian), But Make It Clickable: Setting Up Cockpit for Web-Based Administration</title>
      <dc:creator>Isaac Ntumpi</dc:creator>
      <pubDate>Mon, 19 May 2025 07:09:13 +0000</pubDate>
      <link>https://dev.to/isaac_ntumpi/your-linux-server-debian-but-make-it-clickable-setting-up-cockpit-for-web-based-administration-3cjj</link>
      <guid>https://dev.to/isaac_ntumpi/your-linux-server-debian-but-make-it-clickable-setting-up-cockpit-for-web-based-administration-3cjj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr29se4cvdmplu7i0dmmh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr29se4cvdmplu7i0dmmh.jpg" alt="Image description" width="800" height="377"&gt;&lt;/a&gt;&lt;br&gt;
From the CLI to the Cloud Control Room&lt;/p&gt;

&lt;p&gt;It was 3 AM, and I was knee-deep in systemctl logs, SSH’d into a remote server, eyes half-closed, trying to restart a frozen service. The commands were familiar, but the fatigue was real. That's when I thought: “Why can't Linux server management feel a little more... visual?”&lt;/p&gt;

&lt;p&gt;Not because I don't love the terminal — I do.&lt;br&gt;
But because sometimes, the right interface can speed up your workflow, reduce errors, and make monitoring services actually enjoyable.&lt;/p&gt;

&lt;p&gt;That’s when I met Cockpit — the open-source web GUI for Linux administration.&lt;/p&gt;

&lt;p&gt;This guide walks you through installing and using Cockpit on your Linux server, transforming it into a beautiful, browser-accessible control room. You’ll still have your CLI power — but now with dashboards, charts, toggles, and peace of mind.&lt;/p&gt;

&lt;p&gt;What is Cockpit?&lt;br&gt;
Cockpit is a lightweight, real-time, web-based interface that lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitor system performance&lt;/li&gt;
&lt;li&gt;Manage services, users, and storage&lt;/li&gt;
&lt;li&gt;Update software packages&lt;/li&gt;
&lt;li&gt;Access a web-based terminal&lt;/li&gt;
&lt;li&gt;Manage containers and virtual machines (with plugins)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s fast, secure, and already included in the official repos of many distributions.&lt;/p&gt;
&lt;h2&gt;
  
  
  [Step 1: Update Your Server &amp;amp; Install Cockpit]
&lt;/h2&gt;

&lt;p&gt;Before installing any new package, it's good practice to ensure the system is up to date.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command updates the package lists and upgrades all installed packages to their latest versions.&lt;/p&gt;

&lt;p&gt;Cockpit is available in Ubuntu's official repositories, so installation is simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install cockpit -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This installs the core Cockpit interface. Depending on your use case, you may add modules later.&lt;/p&gt;

&lt;h2&gt;
  
  
  [Step 2: Start and Enable Cockpit]
&lt;/h2&gt;

&lt;p&gt;Cockpit uses systemd and comes with a socket-activated service. Enable and start it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable --now cockpit.socket
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To confirm Cockpit is up and listening:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status cockpit.socket
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Look for Active: active (listening) and port &lt;em&gt;9090&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  [Step 3: Access the Web Interface &amp;amp; Login to Cockpit]
&lt;/h2&gt;

&lt;p&gt;Now, open your browser and navigate to:&lt;/p&gt;

&lt;p&gt;https://:9090&lt;br&gt;
For example: 10.10.0.5 &lt;/p&gt;

&lt;p&gt;⚠️ &lt;em&gt;Don’t worry if you see a self-signed certificate warning. Accept it for now or configure HTTPS properly with Let's Encrypt for production environments.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use your Linux system credentials (e.g., the same user you SSH with).&lt;/li&gt;
&lt;li&gt;If you are using a non-root user, make sure it has sudo privileges.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once logged in, you’ll see a dashboard with real-time stats, system health, storage, networking, logs, and a built-in terminal.&lt;/p&gt;
&lt;h2&gt;
  
  
  [Step 4: Extend Cockpit with Additional Features]
&lt;/h2&gt;

&lt;p&gt;Want more than just basic monitoring? Cockpit supports modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install cockpit-pcp cockpit-networkmanager cockpit-packagekit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;cockpit-pcp for performance metrics&lt;/li&gt;
&lt;li&gt;cockpit-networkmanager for managing networking&lt;/li&gt;
&lt;li&gt;cockpit-packagekit for software updates via GUI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44euw67wwu3bxslzbdoy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44euw67wwu3bxslzbdoy.jpg" alt="Image description" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Cockpit transforms Linux administration from purely command-line to an experience that is clean, visual, and efficient. It empowers you to:&lt;/p&gt;

&lt;p&gt;Respond faster to system issues&lt;/p&gt;

&lt;p&gt;Gain visibility into system health&lt;/p&gt;

&lt;p&gt;Onboard junior admins with ease&lt;/p&gt;

&lt;p&gt;Whether you're managing a home lab, a VPS, or a fleet of servers, Cockpit is a tool worth having.&lt;/p&gt;

&lt;p&gt;You’re still the sysadmin. Just now with a dashboard.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>From Zero to Git Hero: Hosting Your Own GitHub with Gitea on Linux</title>
      <dc:creator>Isaac Ntumpi</dc:creator>
      <pubDate>Sun, 18 May 2025 22:09:15 +0000</pubDate>
      <link>https://dev.to/isaac_ntumpi/from-zero-to-git-hero-hosting-your-own-github-with-gitea-on-linux-3dmj</link>
      <guid>https://dev.to/isaac_ntumpi/from-zero-to-git-hero-hosting-your-own-github-with-gitea-on-linux-3dmj</guid>
      <description>&lt;p&gt;The Dev Who Refused to Be Held Hostage&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhco0l8d1dc6jgvavpehg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhco0l8d1dc6jgvavpehg.jpg" alt="Image description" width="510" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It always starts the same.&lt;br&gt;
You’re building something great—maybe a side project, maybe your startup’s backend. You push your first commit, create a beautiful README, and start dreaming big.&lt;/p&gt;

&lt;p&gt;Then reality hits.&lt;/p&gt;

&lt;p&gt;Suddenly, you're being nudged toward premium pricing tiers, facing storage limits, or worrying about whether your private repo is actually private. And deep down, something tells you: I should own this.&lt;/p&gt;

&lt;p&gt;That was me. And if you're reading this, maybe that's you too.&lt;/p&gt;

&lt;p&gt;What if I told you that you could host your own lightweight, blazing-fast GitHub alternative… entirely for free… on your own server?&lt;/p&gt;

&lt;p&gt;In this guide, I'll walk you through installing Gitea, a modern and minimal Git service platform, on your own Linux box. You’ll never look at GitHub the same way again.&lt;/p&gt;

&lt;p&gt;Let’s take the power back.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Gitea?
&lt;/h2&gt;

&lt;p&gt;Gitea is an open source, self-hosted Git service. Think GitHub, but:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lightweight&lt;/li&gt;
&lt;li&gt;Super fast&lt;/li&gt;
&lt;li&gt;Written in Go&lt;/li&gt;
&lt;li&gt;Easy to install and maintain&lt;/li&gt;
&lt;li&gt;Friendly for solo developers and teams
Perfect if you want control, privacy, and zero dependency on third-party platforms.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Linux-based server (tested on Ubuntu 22.04)&lt;/li&gt;
&lt;li&gt;Root or sudo privileges&lt;/li&gt;
&lt;li&gt;Git installed&lt;/li&gt;
&lt;li&gt;A domain name (optional, but recommended)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  [Step 1: Install Required Packages &amp;amp; Create a Dedicated Gitea User]
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;- Required Packages installation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y
sudo apt install git wget curl unzip -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Dedicated Gitea User creation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo adduser \
  --system \
  --shell /bin/bash \
  --gecos 'Git Version Control' \
  --group \
  --disabled-password \
  --home /home/git \
  git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [Step 2: Download Gitea Binary &amp;amp; Create Necessary Directories]
&lt;/h2&gt;

&lt;p&gt;*&lt;em&gt;- Gitea Binary downloading *&lt;/em&gt;&lt;br&gt;
Visit &lt;a href="https://dl.gitea.io/gitea" rel="noopener noreferrer"&gt;https://dl.gitea.io/gitea&lt;/a&gt; to get the latest version. Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget -O gitea https://dl.gitea.io/gitea/1.21.11/gitea-1.21.11-linux-amd64
chmod +x gitea
sudo mv gitea /usr/local/bin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: Replace the version as needed based on the latest release.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Necessary Directories creation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea/
sudo chmod -R 750 /var/lib/gitea/

sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [Step 3: Create a Gitea Systemd Service File]
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/systemd/system/gitea.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target

[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then reload and start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable --now gitea
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [Step 4: Access the Web Interface]
&lt;/h2&gt;

&lt;p&gt;Visit:&lt;br&gt;
http://:3000&lt;br&gt;
&lt;strong&gt;eg. 192.168.1.123&lt;/strong&gt;&lt;br&gt;
You'll land on the installation page. Fill in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database: SQLite (for testing) or PostgreSQL/MySQL (for production)&lt;/li&gt;
&lt;li&gt;Repository Root Path: /var/lib/gitea/data/git/repositories&lt;/li&gt;
&lt;li&gt;Run User: git&lt;/li&gt;
&lt;li&gt;Domain: Your server’s IP or domain&lt;/li&gt;
&lt;li&gt;SSH Port: 22&lt;/li&gt;
&lt;li&gt;HTTP Port: 3000&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once configured, click Install Gitea.&lt;/p&gt;

&lt;p&gt;Boom 💥 — Your own GitHub is live&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By hosting Gitea on your own server, you’re not just setting up another tool —&lt;br&gt;
you’re reclaiming your autonomy.&lt;/p&gt;

&lt;p&gt;You now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Own your codebase&lt;/li&gt;
&lt;li&gt;Control user access&lt;/li&gt;
&lt;li&gt;Avoid vendor lock-in&lt;/li&gt;
&lt;li&gt;Spend $0 while scaling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s a small step for your terminal, but a giant leap for your developer independence.&lt;/p&gt;

&lt;p&gt;And hey — if you're building a team, a startup, or just want to sharpen your DevOps edge, there's nothing more powerful than owning the pipeline from git init to production.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Set It and Forget It: Automate Daily EC2 Lifecycle with Python Like a Pro</title>
      <dc:creator>Isaac Ntumpi</dc:creator>
      <pubDate>Sun, 18 May 2025 21:15:01 +0000</pubDate>
      <link>https://dev.to/isaac_ntumpi/set-it-and-forget-it-automate-daily-ec2-lifecycle-with-python-like-a-pro-5b03</link>
      <guid>https://dev.to/isaac_ntumpi/set-it-and-forget-it-automate-daily-ec2-lifecycle-with-python-like-a-pro-5b03</guid>
      <description>&lt;p&gt;A Cloud Engineer's Midnight Regret&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnggorwfkgre6d27taww.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnggorwfkgre6d27taww.jpg" alt="Image description" width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s 00:12 AM.&lt;br&gt;
You’re brushing your teeth, mentally preparing for tomorrow’s stand-up, when it hits you like a thunderbolt:&lt;/p&gt;

&lt;p&gt;“Wait… did I forget to shut down the EC2 instances?”&lt;/p&gt;

&lt;p&gt;You sprint back to your laptop, heart racing, praying your cloud bill isn’t already ballooning past reason.&lt;br&gt;
The AWS Console loads… slowly.&lt;br&gt;
You sigh in frustration.&lt;br&gt;
Another night, another bill for machines you weren’t using.&lt;/p&gt;

&lt;p&gt;If this scene feels familiar, you’re not alone. Many engineers — from solo devs to seasoned sysadmins — struggle to manage cloud resources with surgical precision, especially when those resources are needed only part of the day.&lt;/p&gt;

&lt;p&gt;The good news?&lt;br&gt;
There’s a fix — and it’s beautifully simple.&lt;/p&gt;

&lt;p&gt;In this article, you’ll build a smart, Python-powered automation that shuts down all your EC2 instances at midnight and wakes them up at 5 AM — every day — without fail.&lt;br&gt;
We’ll walk through the process step by step, with logs you can watch live and full control over your infrastructure. No serverless complexity, no expensive automation platforms.&lt;/p&gt;

&lt;p&gt;Just you, Python, and a little crontab magic.&lt;br&gt;
Let’s automate like professionals. &lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Make sure you have the following ready:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account with programmatic access (Access Key &amp;amp; Secret)&lt;/li&gt;
&lt;li&gt;A Linux environment (local machine, EC2 instance, or WSL on Windows)&lt;/li&gt;
&lt;li&gt;Python 3 installed&lt;/li&gt;
&lt;li&gt;boto3 and awscli installed&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  [Step 1: Install Required Tools]
&lt;/h2&gt;

&lt;p&gt;Install the AWS SDK for Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install boto3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure your AWS credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll be prompted to enter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your Access Key ID&lt;/li&gt;
&lt;li&gt;Your Secret Access Key&lt;/li&gt;
&lt;li&gt;Default AWS region (e.g. us-east-1)&lt;/li&gt;
&lt;li&gt;Default output format (e.g. json)
This generates the necessary configuration under &lt;em&gt;&lt;strong&gt;~/.aws/credentials.&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  [Step 2: Write the Python Scripts]
&lt;/h2&gt;

&lt;p&gt;We'll create two Python scripts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stop_ec2.py → to stop instances at 00:00&lt;/li&gt;
&lt;li&gt;start_ec2.py → to start instances at 05:00&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;stop_ec2.py&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/ec2_scheduler
cd ~/ec2_scheduler
nano stop_ec2.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/env python3
import boto3

def stop_all_instances():
    ec2 = boto3.client('ec2')
    response = ec2.describe_instances(Filters=[{
        'Name': 'instance-state-name',
        'Values': ['running']
    }])

    instances_to_stop = []
    for reservation in response['Reservations']:
        for instance in reservation['Instances']:
            instances_to_stop.append(instance['InstanceId'])

    if instances_to_stop:
        print("Stopping instances:", instances_to_stop)
        ec2.stop_instances(InstanceIds=instances_to_stop)
    else:
        print("No running instances found.")

if __name__ == "__main__":
    stop_all_instances()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make it executable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x stop_ec2.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;start_ec2.py&lt;/strong&gt;&lt;br&gt;
Now let’s create the startup script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano start_ec2.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/env python3
import boto3

def start_all_instances():
    ec2 = boto3.client('ec2')
    response = ec2.describe_instances(Filters=[{
        'Name': 'instance-state-name',
        'Values': ['stopped']
    }])

    instances_to_start = []
    for reservation in response['Reservations']:
        for instance in reservation['Instances']:
            instances_to_start.append(instance['InstanceId'])

    if instances_to_start:
        print("Starting instances:", instances_to_start)
        ec2.start_instances(InstanceIds=instances_to_start)
    else:
        print("No stopped instances found.")

if __name__ == "__main__":
    start_all_instances()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And make it executable too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x start_ec2.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [Step 3: Schedule Scripts Using crontab]
&lt;/h2&gt;

&lt;p&gt;Open the crontab editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following lines at the bottom:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 0 * * * /usr/bin/python3 /home/isaac/ec2_scheduler/stop_ec2.py &amp;gt;&amp;gt; /home/your_user/ec2_scheduler/stop.log 2&amp;gt;&amp;amp;1
0 5 * * * /usr/bin/python3 /home/isaac/ec2_scheduler/start_ec2.py &amp;gt;&amp;gt; /home/your_user/ec2_scheduler/start.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;strong&gt;/home/isaac/&lt;/strong&gt; with your actual username or full path.&lt;/p&gt;

&lt;p&gt;You can verify your crontab jobs were added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [Step 4: Monitor with tail -f]
&lt;/h2&gt;

&lt;p&gt;To watch logs in real time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail -f ~/ec2_scheduler/stop.log
# or
tail -f ~/ec2_scheduler/start.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll see output like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stopping instances: ['i-01abcd2345efgh678']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No stopped instances found.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  IAM Policy Required
&lt;/h2&gt;

&lt;p&gt;Your IAM user or role should have the following minimum permissions:&lt;br&gt;
It's a json file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Manual Testing (Optional)
&lt;/h2&gt;

&lt;p&gt;You can manually trigger the scripts to test them before relying on the cron jobs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 stop_ec2.py
python3 start_ec2.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then check the logs with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail ~/ec2_scheduler/stop.log
tail ~/ec2_scheduler/start.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we’ve built a clean, reliable automation to manage AWS EC2 instances using nothing but Python and Linux’s built-in cron scheduler. This setup is especially helpful for dev/test environments, overnight cost reduction, or any non-production workloads that don’t need to be running 24/7.&lt;/p&gt;

&lt;p&gt;By combining boto3, crontab, and log monitoring with tail -f, you've gained fine-grained control over your cloud environment — no expensive scheduler tools, no overengineering. Just simple, effective DevOps.&lt;/p&gt;

&lt;p&gt;Take it further by filtering EC2 instances by tags, regions, or instance types, or by sending email alerts on failures.&lt;/p&gt;

&lt;p&gt;Automation isn't just about convenience — it's about discipline, consistency, and clarity in your operations.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>aws</category>
      <category>linux</category>
      <category>python</category>
    </item>
    <item>
      <title>Hello World Every Minute: Crontab + Live Log Tailing</title>
      <dc:creator>Isaac Ntumpi</dc:creator>
      <pubDate>Thu, 15 May 2025 08:12:50 +0000</pubDate>
      <link>https://dev.to/isaac_ntumpi/hello-world-every-minute-crontab-live-log-tailing-38kh</link>
      <guid>https://dev.to/isaac_ntumpi/hello-world-every-minute-crontab-live-log-tailing-38kh</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxe9wxqisuirggh8y7m7e.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxe9wxqisuirggh8y7m7e.jpg" alt="Image description" width="553" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When managing Linux systems, automating repetitive tasks is key to efficiency and consistency. With crontab, you can schedule scripts to run at any interval — including every minute. In this short guide, we’ll create a script that simply prints HELLO WORLD, schedule it to run every minute, and log its output. You'll also learn how to monitor it live using tail -f, a powerful command-line tool for real-time log viewing.&lt;/p&gt;

&lt;h2&gt;
  
  
  [Step 1: Create the Python File]
&lt;/h2&gt;

&lt;p&gt;Open a terminal and create the script file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/hello.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/env python3
from datetime import datetime

logfile = "/home/$USER/hello.log"  # Replace $USER manually if needed

with open(logfile, "a") as f:
    now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    f.write(f"[{now}] HELLO WORLD\n")

print("HELLO WORLD")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tip: Replace &lt;em&gt;"/home/$USER/hello.log"&lt;/em&gt; with your actual path, for example: &lt;em&gt;"/home/isaac/hello.log"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then make the file executable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x ~/hello.py  #bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [Step 2: Add the script to crontab and Test and monitor logs live]
&lt;/h2&gt;

&lt;p&gt;Open your user’s crontab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this line at the bottom:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * * /usr/bin/python3 /home/your_user/hello.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a minute, check if the log file was created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l ~/hello.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, use tail -f to monitor the log in real-time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail -f ~/hello.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a new "HELLO WORLD" line appear every minute. Like on below image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbqyc4mymocfzq5dw2yyz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbqyc4mymocfzq5dw2yyz.jpg" alt="Image description" width="738" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By following this step-by-step guide, you've learned how to schedule a simple Python script to run every minute using crontab. This script prints and logs a message, giving you a hands-on understanding of how cron jobs, logging, and real-time monitoring with tail -f work together in a Linux environment.&lt;/p&gt;

&lt;p&gt;Even though this example is simple—just printing "HELLO WORLD"—the approach is powerful and scalable. You can adapt this pattern to automate tasks like data collection, backups, notifications, or system health checks.&lt;/p&gt;

&lt;p&gt;Whether you're a beginner exploring automation or a developer integrating scripts into a production pipeline, mastering cron and logging is a foundational skill. Keep experimenting, build smarter scripts, and level up your DevOps toolbox!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
