- Conditional Statements | Shell Script
============================================================
============================================================
2) Looping Statements | Shell Script
============================================================
============================================================
#For loop
============================================================
============================================================
#While loop
============================================================
============================================================
3) Automating Linux System Backups with Bash
- Categorize unauthorized packages by risk: Critical (hacking tools, backdoors), High (unauthorized servers/services), Medium (unnecessary software), Low (utilities).
- For packages in the approved list, check if the installed version meets the minimum version requirement. List packages that are outdated.
- Audit script
- From disk_usage.txt, which partitions are in CRITICAL (>90%), WARNING (>80%), and OK state? Show usage as a formatted table.
- Write crontab entries: run disk alert every hour, run cleanup weekly at Sunday 3 AM, delete gzipped logs older than 90 days monthly.
- Create a full project backup excluding: .git/, uploads/temp/, logs/, *.pyc files. Name: webapp_clean_YYYYMMDD.tar.gz
- Use grep to scan all config files for sensitive data (strings like password, secret, key, pass). List every file that contains credentials.
- Cross-reference server_inventory.csv with failures. Which roles are affected? What is the business impact?
- From network_connections.txt, identify suspicious listening ports and outbound connections. Which are legitimate? Which are malicious?
- Incident Report Script
- From deploy_history.log, extract all FAILED deployments. List the version, date, and root cause for each.