---
title: "Discussion on \"One Shell Script to Backup and Clean Old Logs\" | Hashnode"
description: "Discussion on \"One Shell Script to Backup and Clean Old Logs\". #!/bin/bash\n\nuserid=$(id -u)\n\n# Log Details\nLOGS_FOLDER=\"/var/log/shellscript\"\nSCRIPT_NAME=\\((basename \"\\)0\" .sh)\nLOG_FILE=\"\\(LOGS_FOLDER/\\)SCRIPT_NAME.log\"\n\n# Color codes\nR=\"\\e[31m\"\nG=\"\\e[32m\"\nY=\"\\e["
url: "https://hashnode.com/posts/backup-and-clean-old-logs/6a3eaf562734d9cc8f7feb25"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [One Shell Script to Backup and Clean Old Logs](https://devopswithpmpk.hashnode.dev/backup-and-clean-old-logs?utm_source=hashnode&utm_medium=feed)

#!/bin/bash userid=$(id -u) # Log Details LOGS\_FOLDER="/var/log/shellscript" SCRIPT\_NAME=\\((basename "\\)0" .sh) LOG\_FILE="\\(LOGS\_FOLDER/\\)SCRIPT\_NAME.log" # Color codes R="\\e\[31m" G="\\e\[32m" Y="\\e\[

Jun 26 · 3 min read · devopswithpmpk.hashnode.dev  
Read the article

-   [#shell-scripting](https://hashnode.com/tag/shell-scripting)
-   [#shellscripting-devops](https://hashnode.com/tag/shellscripting-devops)
-   [#automation](https://hashnode.com/tag/automation)
-   [#backup-and-clean-old-logs](https://hashnode.com/tag/backup-and-clean-old-logs)
-   [#aws](https://hashnode.com/tag/aws)
-   [#devops](https://hashnode.com/tag/devops)
-   [#sre](https://hashnode.com/tag/sre)

## Written by

[Puppala Manikanta Pavan Kumar](https://hashnode.com/@pavankumarpuppala)

@pavankumarpuppala

  
[View profile](https://hashnode.com/@pavankumarpuppala)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
