Operations 6 min read

How to Determine Whether a Server Is Still in Use Before Decommissioning

This article outlines a systematic approach for ops teams to assess whether a low‑utilization server is still needed by checking user logins, running services, network connections, cron jobs, and file storage—including specific commands for MySQL and PostgreSQL data inspection—to avoid accidental data loss during reclamation.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
How to Determine Whether a Server Is Still in Use Before Decommissioning

Background

Recently the ops team initiated a cleanup of under‑utilized servers. Most were reclaimed successfully, but some were mistakenly removed, highlighting the need to verify whether a server is still in use.

Key Points to Check

Generally I focus on the following aspects:

Whether any user has logged in.

Whether any service processes are running.

Whether there are active network connections.

Check for existing cron jobs.

Check for stored files.

The last two items—cron jobs and file storage—are often overlooked; a server used primarily for storage may show little activity in processes or connections, and premature reclamation could cause serious data loss.

Check User Logins

Use the command: last This displays user login times.

Check Service Processes

top
free
uptime

Check Network Connections

Command:

netstat

Check Disk Files

Commands:

df -h
du -h

If the disk shows gigabytes of user files, examine file ownership, confirm with owners, and decide before deletion or reclamation.

My logic is clear:

Whether the disk contains only system directories.

In non‑system directories, whether user directories contain large files.

Whether MySQL data directories and files are present.

Whether PostgreSQL data directories and files are present.

If any of the above are true, identify file owners, communicate, and then decide.

Inspect MySQL Data Files

Check for open MySQL files: sudo lsof | grep mysql Check for stored MySQL files: sudo find / -user mysql It is prudent to review /etc/passwd and /etc/group for the MySQL user and group, then adjust the commands accordingly. I usually look at known directories such as /var/run/mysql and also under /home/q or /export for any MySQL traces.

Inspect PostgreSQL Data Files

Check for open PostgreSQL files: sudo lsof | grep post Check for stored PostgreSQL files: sudo find / -user postgres Similarly, examine /etc/passwd and /etc/group for the PostgreSQL user, then tailor the commands. I often check directories like /var/run/postgresql and look under /home/q or /export for any PostgreSQL remnants, including home directories named /home/post* or /home/q/post*.

Check Cron Jobs

sudo cat /var/spool/cron/*
ls -al /etc/cron.*/*

If these commands reveal unfamiliar entries, pause and investigate before proceeding.

He Weiping Search Technology Researcher and Database Researcher, translator of the first Chinese PostgreSQL manual and third edition of Programming Perl. Over 18 years of experience in search, distributed systems, databases, and cluster management. Currently leads Qunar.com vacation business.

Article originally from the company wiki “老何的1001夜”. Qunar colleagues can log in to the wiki for more articles.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

monitoringcronServerdecommission
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.