_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Bash scripting for server automation

03. 11. 2011 1 min read CORE SYSTEMSai

Three servers you can manage by hand. Twenty servers across three environments? Manual deployment is a full day’s work and a source of errors. Bash scripts are the simplest path to automation.

Deployment script

Downloads an artifact from Nexus, stops Tomcat on each server, copies the WAR file, starts it, runs a health check. set -euo pipefail — the script stops on the first error. The server list is in an external file.

Backup with rotation

Tar + gzip of configuration files. Rotation of files older than 30 days. Integrity check after creation. Failure = email alert.

Log monitoring

Searches for ERROR and FATAL in application logs since the last run. A state file tracks the current position. New errors are sent by email. Runs every 5 minutes via cron.

SSH multiplexing

SSH ControlMaster keeps a single connection open. A second SSH command is instant. On a deployment with twenty servers, this saves minutes.

Conclusion

Bash scripts save hours, eliminate errors and create repeatable processes. Version them in SVN and test on staging.

bashlinuxautomatizacescripting
Share:

CORE SYSTEMS

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us