Day 19 of #90DaysOfDevOps - Log Rotation, Backup & Crontab Today I worked on a real-world Shell Scripting project where I built automation scripts 🔧 What I built: • Log Rotation Script – compress old logs & clean up storage • Backup Script – create timestamped backups automatically • Crontab Setup – schedule jobs like a real server • Maintenance Script – combined everything into one automation ⏰ Automated tasks: • Log rotation → daily at 2 AM • Backup → every Sunday at 3 AM • Health check → every 5 minutes • Full maintenance → daily at 1 AM Checkout my work: https://lnkd.in/gJkC8_5Z #90DaysOfDevOps #DevOps #Linux #ShellScripting #Automation #Cloud #AWS #LearningInPublic #BuildInPublic #DevOpsJourney #Programming #Coding #Tech #CareerGrowth #Consistency #DevOpsKaJosh #TrainWithShubham
Log Rotation, Backup & Crontab Automation Scripts in Shell Scripting
More Relevant Posts
-
## 🐧 Decoding Linux Pipes: Anonymous vs. Named Ever wondered how data flows seamlessly between processes in Linux? It’s all about the **Pipe**. Whether you're a DevOps engineer or a curious dev, understanding Inter-Process Communication (IPC) is a game-changer for system performance. Here is a quick breakdown of the two main types: ### 1. Anonymous Pipes (The "Quick & Dirty") These are the unsung heroes of the command line. When you run ls | grep .txt, you’re using an anonymous pipe. * **Scope:** Limited to parent-child processes. * **Lifespan:** Temporary; they vanish the moment the execution finishes. * **Setup:** No file entry—it’s all happening in the kernel's memory. ### 2. Named Pipes (The "FIFO" Method) Need two completely unrelated processes to talk? Enter the Named Pipe, created via mkfifo. * **Scope:** Any two processes can communicate. * **Lifespan:** Persistent. It exists as a special file in your filesystem until you manually delete it. * **Visibility:** You’ll see it marked with a p type when running ls -l. **Pro Tip:** Use Anonymous pipes for simple, linear data transformations and Named pipes when building more complex, modular systems that require asynchronous communication. **Which one do you find yourself using more often in your workflows? Let's discuss below! 👇** #Linux #DevOps #SystemArchitecture #Programming #CodingTips #BackendDevelopment #LinuxKernel #TechEducation
To view or add a comment, sign in
-
-
Hi All, Let's understand and learn more about the Cronjobs in Linux In real systems, not every task needs to run all the time. Some tasks need to run at specific times. For example, taking backups at night or cleaning logs daily. Cron jobs help us do this automatically. A cron job is a scheduler. You tell it when to run and what command to run. The format looks like this: 𝗺𝗶𝗻𝘂𝘁𝗲 𝗵𝗼𝘂𝗿 𝗱𝗮𝘆-𝗼𝗳-𝗺𝗼𝗻𝘁𝗵 𝗺𝗼𝗻𝘁𝗵 𝗱𝗮𝘆-𝗼𝗳-𝘄𝗲𝗲𝗸 𝗰𝗼𝗺𝗺𝗮𝗻𝗱 Each field means: minute → 0 to 59 hour → 0 to 23 day of month → 1 to 31 month → 1 to 12 day of week → 0 to 7 (Sunday) Examples: 0 2 * * * /home/sai/backup sh Runs every day at 2 AM */5 * * * * /home/sai/health_check sh Runs every 5 minutes Basic commands: 𝗰𝗿𝗼𝗻𝘁𝗮𝗯 -𝗲 → 𝗲𝗱𝗶𝘁 𝗰𝗿𝗼𝗻 𝗷𝗼𝗯𝘀 𝗰𝗿𝗼𝗻𝘁𝗮𝗯 -𝗹 → 𝗹𝗶𝘀𝘁 𝗰𝗿𝗼𝗻 𝗷𝗼𝗯𝘀 𝗰𝗿𝗼𝗻𝘁𝗮𝗯 -𝗿 → 𝗿𝗲𝗺𝗼𝘃𝗲 𝗰𝗿𝗼𝗻 𝗷𝗼𝗯𝘀 In production, cron jobs are used for 𝗯𝗮𝗰𝗸𝘂𝗽𝘀, 𝗹𝗼𝗴 𝗰𝗹𝗲𝗮𝗻𝘂𝗽, 𝗱𝗮𝘁𝗮 𝘀𝘆𝗻𝗰, 𝗮𝗻𝗱 𝗿𝗲𝗽𝗼𝗿𝘁 𝗴𝗲𝗻𝗲𝗿𝗮𝘁𝗶𝗼𝗻. But they need monitoring. If a cron job fails, you may not notice immediately. A failed backup or cleanup can create problems later. Another common issue is overlapping runs. If a job takes longer than expected and runs again, it can cause duplicate work or conflicts. The idea is simple. Cron jobs run small tasks at the right time and keep systems running smoothly without manual effort. refer the below links for more information: https://lnkd.in/gZJHps67 https://lnkd.in/gSKFhqza https://lnkd.in/gpEp_grE #cronjobs #crontab #automation #scheduledtasks #devops #sre #K8s #backups #cloudengineer #devopengineer #DevOps #DevOpsEngineer #linux #linuxadmin #cronscheduler #infracommunity #devopscommunity #linuxcommunity #redhat #developers #cicd
To view or add a comment, sign in
-
-
🚨 Most DevOps engineers use Linux daily…............... But many don’t fully understand its file system — and that’s a hidden gap. If you work with:- ⚙️ Kubernetes ⚙️ CI/CD pipelines ⚙️ Cloud VMs Then Linux isn’t just a tool — it’s your foundation................... 📂 Linux File System (Simplified): /boot → Boot files (kernel, GRUB) /etc → System configuration /home → User files /root → Root user home /opt → Third-party apps /dev → Devices as files /var → Logs & runtime data (start here for debugging) /bin → Basic commands /sbin → Admin commands /usr → Apps & libraries /proc → Process info (real-time) /sys → Hardware interface /run → Runtime data /tmp → Temporary files 📌 Bonus: /lib, /lib64 → Libraries /mnt, /media → Mount points /srv → Service data /lost+found → Recovered files 💡 Why it matters: ✔ Faster debugging (/var/log first) ✔ Better automation ✔ Stronger security handling ✔ More confidence in production 👉 Don’t just use Linux. Master it. #DevOps #Linux #CloudComputing #Kubernetes #AWS #Azure #SRE #Infrastructure #SysAdmin #TechCareers #Programming #Containers #CICD #LearningInPublic #CareerGrowth
To view or add a comment, sign in
-
-
DevOps looks fancy from the outside. AWS dashboards Python automation scripts Cool web Uls CI/CD pipelines Everything looks modern and powerful. But when production actually breaks... Suddenly everyone is back to: ssh into the server checking logs in /var/log running random Linux commands writing a quick Bash script to fix something 😅 And that's when you realize something interesting. Behind every fancy cloud platform... behind every automation tool... there is stil: 🐧Linux 💻 Bash 🔨CLI tools Quietly running the entire internet. No fancy UI. No colorful dashboards Just a terminal... and someone who knows what they're doing. DevyOps lesson l learned: You can ignore Bash and Linux at the start. But sooner or later... the terminal will find you.🥲 #DevOps #Linux #Bash #CloudComputing #AWS #Techhumor #CloudEngineer #Automation
To view or add a comment, sign in
-
-
Most DevOps engineers use Linux daily… But many don’t fully understand its file system and that’s a hidden gap. If you work with: Kubernetes CI/CD pipelines Cloud VMs Then Linux isn’t just a tool it’s your foundation. Linux File System (Simplified): /boot → Boot files (kernel, GRUB) /etc → System configuration /home → User files /root → Root user home /opt → Third-party apps /dev → Devices as files /var → Logs & runtime data (start here for debugging) /bin → Basic commands /sbin → Admin commands /usr → Apps & libraries /proc → Process info (real-time) /sys → Hardware interface /run → Runtime data /tmp → Temporary files Bonus: /lib, /lib64 → Libraries /mnt, /media → Mount points /srv → Service data /lost+found → Recovered files Why it matters: Faster debugging (/var/log first) Better automation Stronger security handling More confidence in production Don’t just use Linux. Master it. Consider a Repost if you found this helpful #DevOps #Linux #CloudComputing #Kubernetes #AWS #Azure #SRE #Infrastructure #SysAdmin #TechCareers #Programming #Containers #CICD #LearningInPublic #CareerGrowth #Learnwithshruthi #careerbytecode #linkedin
To view or add a comment, sign in
-
-
🚀 Day 20 – Log Analyzer and Report Generator Today I built a Log Analyzer & Report Generator using Bash scripting 💻 🔍 What it does: ✔️ Validates input log file ✔️ Counts total ERROR / Failed logs ✔️ Extracts CRITICAL events with line numbers ✔️ Finds Top 5 most frequent errors ✔️ Generates a clean summary report 📄 ✔️ Archives processed logs automatically 💡 Key Learning: Logs are gold in DevOps — analyzing them properly helps detect issues early and improves system reliability. Checkout my code: https://lnkd.in/g7FsuDiz #DevOps #BashScripting #Linux #Automation #LogAnalysis #Scripting #LearningInPublic #100DaysOfCode #TechJourney #CloudComputing #SystemAdmin #DevOpsEngineer #90DaysOfDevOps #DevOpsKaJosh #TrainWithShubham
To view or add a comment, sign in
-
🚨 Most DevOps engineers use Linux daily… But many don’t fully understand its file system — and that’s a hidden gap. If you work with: ⚙️ Kubernetes ⚙️ CI/CD pipelines ⚙️ Cloud VMs Then Linux isn’t just a tool — it’s your foundation. 📂 Linux File System (Simplified): /boot → Boot files (kernel, GRUB) /etc → System configuration /home → User files /root → Root user home /opt → Third-party apps /dev → Devices as files /var → Logs & runtime data (start here for debugging) /bin → Basic commands /sbin → Admin commands /usr → Apps & libraries /proc → Process info (real-time) /sys → Hardware interface /run → Runtime data /tmp → Temporary files 📌 Bonus: /lib, /lib64 → Libraries /mnt, /media → Mount points /srv → Service data /lost+found → Recovered files 💡 Why it matters: ✔ Faster debugging (/var/log first) ✔ Better automation ✔ Stronger security handling ✔ More confidence in production 👉 Don’t just use Linux. Master it. #DevOps #Linux #CloudComputing #Kubernetes #AWS #Azure #SRE #Infrastructure #SysAdmin #TechCareers #Programming #Containers #CICD #LearningInPublic #CareerGrowth
To view or add a comment, sign in
-
-
🚨 Most DevOps engineers use Linux daily… But many don’t fully understand its file system — and that’s a hidden gap. If you work with: ⚙️ Kubernetes ⚙️ CI/CD pipelines ⚙️ Cloud VMs Then Linux isn’t just a tool — it’s your foundation. 📂 Linux File System (Simplified): /boot → Boot files (kernel, GRUB) /etc → System configuration /home → User files /root → Root user home /opt → Third-party apps /dev → Devices as files /var → Logs & runtime data (start here for debugging) /bin → Basic commands /sbin → Admin commands /usr → Apps & libraries /proc → Process info (real-time) /sys → Hardware interface /run → Runtime data /tmp → Temporary files 📌 Bonus: /lib, /lib64 → Libraries /mnt, /media → Mount points /srv → Service data /lost+found → Recovered files 💡 Why it matters: ✔ Faster debugging (/var/log first) ✔ Better automation ✔ Stronger security handling ✔ More confidence in production 👉 Don’t just use Linux. Master it. #DevOps #Linux #CloudComputing #Kubernetes #AWS #Azure #SRE #Infrastructure #SysAdmin #TechCareers #Programming #Containers #CICD #LearningInPublic #CareerGrowth
To view or add a comment, sign in
-
-
🚨 Most DevOps engineers use Linux daily… But many don’t fully understand its file system — and that’s a hidden gap. If you work with: ⚙️ Kubernetes ⚙️ CI/CD pipelines ⚙️ Cloud VMs Then Linux isn’t just a tool — it’s your foundation. 📂 Linux File System (Simplified): /boot → Boot files (kernel, GRUB) /etc → System configuration /home → User files /root → Root user home /opt → Third-party apps /dev → Devices as files /var → Logs & runtime data (start here for debugging) /bin → Basic commands /sbin → Admin commands /usr → Apps & libraries /proc → Process info (real-time) /sys → Hardware interface /run → Runtime data /tmp → Temporary files 📌 Bonus: /lib, /lib64 → Libraries /mnt, /media → Mount points /srv → Service data /lost+found → Recovered files 💡 Why it matters: ✔ Faster debugging (/var/log first) ✔ Better automation ✔ Stronger security handling ✔ More confidence in production 👉 Don’t just use Linux. Master it. #DevOps #Linux #CloudComputing #Kubernetes #AWS #Azure #SRE #Infrastructure #SysAdmin #TechCareers #Programming #Containers #CICD #LearningInPublic #CareerGrowth
To view or add a comment, sign in
-
-
🚀 Terraform Variables: Complete Guide If you're working with Infrastructure as Code, mastering Terraform variables is a must! Here's everything you need to know in one infographic 👇 🔷 8 Variable Types: string number bool list(string) map(string) tuple object set(string) 🔷 3 Ways to Assign Values: ✅ .tfvars file ✅ TF_VAR_ environment variable ✅ -var CLI flag 🔷 Precedence Order (most misunderstood!): Default value → .tfvars → TF_VAR_ → -var CLI flag ⚠️ CLI flag always wins! 💡 Understanding precedence saves you hours of debugging in real projects. Save this post for your next Terraform project! 🔖 #IaC #InfrastructureAsCode #AWS #Azure #GCP #CloudComputing #DevOps #DevSecOps #SRE #PlatformEngineering #CloudNative #CloudArchitecture #TechLearning #LearnDevOps #DevOpsEngineer #CloudEngineer #100DaysOfCloud #Automation #Linux #OpenSource #Programming #Coding #SoftwareEngineering #TechCommunity #Technology #Innovation
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development