{"id":19436540,"url":"https://github.com/mrxehmad/server-maintenance","last_synced_at":"2026-04-12T01:34:47.427Z","repository":{"id":244242997,"uuid":"814677934","full_name":"mrxehmad/Server-Maintenance","owner":"mrxehmad","description":" shell script designed for weekly maintenance of a Debian server. The script performs essential tasks such as clearing various caches, removing unused Docker resources, cleaning APT cache, and managing log files","archived":false,"fork":false,"pushed_at":"2024-10-13T03:57:32.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T21:13:19.026Z","etag":null,"topics":["apt-cache","automation","cron-jobs","debian","docker-cleanup","linux","performance-optimization","server-maintenance","shell-script","system-administration"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrxehmad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-13T13:30:49.000Z","updated_at":"2024-10-13T03:57:35.000Z","dependencies_parsed_at":"2024-06-13T16:12:54.741Z","dependency_job_id":null,"html_url":"https://github.com/mrxehmad/Server-Maintenance","commit_stats":null,"previous_names":["mrxehmad/server-maintenance"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxehmad%2FServer-Maintenance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxehmad%2FServer-Maintenance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxehmad%2FServer-Maintenance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxehmad%2FServer-Maintenance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrxehmad","download_url":"https://codeload.github.com/mrxehmad/Server-Maintenance/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240619428,"owners_count":19830204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apt-cache","automation","cron-jobs","debian","docker-cleanup","linux","performance-optimization","server-maintenance","shell-script","system-administration"],"created_at":"2024-11-10T15:11:40.817Z","updated_at":"2025-10-16T05:04:02.088Z","avatar_url":"https://github.com/mrxehmad.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Debian Server Weekly Maintenance Script\n\nThis repository contains a shell script to perform weekly maintenance tasks on a Debian server. The script clears various caches, removes unused Docker data, cleans the APT cache, and performs other housekeeping tasks to ensure optimal server performance.\n\n## Features\n\n- Clear PageCache, dentries, and inodes\n- Remove unused Docker images, containers, volumes, and networks\n- Clean APT cache and remove unnecessary packages\n- Clear systemd journal logs older than 7 days\n- Clear temporary files in `/tmp` and `/var/tmp`\n\n## Usage\n\n### Setup\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/mrxehmad/Server-Maintenance.git\n   cd Server-Maintenance\n   ```\n\n2. **Copy the script to `/usr/local/bin`:**\n   ```bash\n   sudo cp weekly_maintenance.sh /usr/local/bin/\n   ```\n\n3. **Make the script executable:**\n   ```bash\n   sudo chmod +x /usr/local/bin/weekly_maintenance.sh\n   ```\n\n4. **Set up the cron job:**\n   ```bash\n   sudo crontab -e\n   ```\n\n   Add the following line to the crontab file to run the script every Sunday at 2 AM:\n   ```bash\n   0 2 * * 0 /usr/local/bin/weekly_maintenance.sh \u003e /var/log/weekly_maintenance.log 2\u003e\u00261\n   ```\n\n\n### Verify Cron Job\n\nTo verify that the cron job is set up correctly, you can list the current cron jobs:\n\n```bash\nsudo crontab -l\n```\n\n### Manual Execution\n\nYou can manually run the script to test it:\n\n```bash\nsudo /usr/local/bin/weekly_maintenance.sh\n```\n\n### Logging\n\nThe cron job redirects both stdout and stderr to a log file (`/var/log/weekly_maintenance.log`). Check this file to see the output of the script and troubleshoot any issues.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any changes or improvements.\n\n## Author\n\n[mrxehmad](https://github.com/mrxehmad)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxehmad%2Fserver-maintenance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrxehmad%2Fserver-maintenance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxehmad%2Fserver-maintenance/lists"}