r/linuxadmin • u/Arun_kumar_95 • 7d ago
A simple, lightweight Bash script to check server status from a server.txt list using ping."
Hey everyone! 👋
Often, small setups don't need heavy monitoring software like Prometheus or Grafana just to check if multiple servers or IPs are up and running.
So, I built a quick, lightweight Bash automation script that reads a list of servers from a server.txt file and pings them automatically to check their live status.
How it works:
- Reads line by line from
server.txt. - Validates the entry using regex.
- Sends a ping request and prints out whether the server is running or down.
Check out the snippet below! Always looking for feedback or ways to optimize it. 🚀
5
2
u/Cirked 7d ago
I don't disagree less is more, but you have to manage either a cron to run this, or manually check yourself?
Picking the free tier of uptimerobot, or similar, would surely save a headache here
1
u/emprahsFury 7d ago
what if server.txt is a fifo and we just dump server.txt into server.txt continuously? Would that work (no I won't try it myself).
1
5
u/PipeItToDevNull 7d ago
Jesus, this isn't even vibe coding it is just a straight AI hooked to reddit
5
2
u/theschizopost 7d ago
You spelled "running" wrong
-2
u/emprahsFury 7d ago
strictly speaking, when you use an adverb to modify a verb you should add -ly as a suffix. So he spelled running wrongly. Like you spelled wrongly wrongly. It's ok- dictionaries aren't prescriptive. You should consider switching to French though, where they are.
1
u/ikdoeookmaarwat 7d ago
> French
Based upon? Time in the screenshot tells you differently.
-1
u/emprahsFury 7d ago edited 7d ago
Let the ai help you figure it out. "Consider switching to French," where their dictionaries are prescriptive. No idea why people insist on commenting that literally cannot understand either what their writing (grandparent comment) or what they're reading (you). And I'm incredibly sorry to tell you that the english localization is on the screenshot. So you don't even need to guess using the clock about where or what language is being used.
1
u/Cyber-tech-432 7d ago
IO often takes time, why not just load file in memory or save in variable and set a timer to reload file every few minutes
1
1


20
u/ikdoeookmaarwat 7d ago
I have no idea why you would share a simple bash script with an image.