{"id":26430624,"url":"https://github.com/estaji/useful-bash-scripts","last_synced_at":"2026-05-09T16:19:47.144Z","repository":{"id":168357823,"uuid":"606044576","full_name":"estaji/useful-bash-scripts","owner":"estaji","description":"A group of useful bash scripts","archived":false,"fork":false,"pushed_at":"2025-03-16T05:52:32.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T06:25:23.905Z","etag":null,"topics":["bash","bash-script"],"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/estaji.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-02-24T13:26:43.000Z","updated_at":"2025-03-16T05:52:36.000Z","dependencies_parsed_at":"2024-01-08T06:44:26.910Z","dependency_job_id":"d99fa673-fd50-4cb1-8c5f-bad92c98cec8","html_url":"https://github.com/estaji/useful-bash-scripts","commit_stats":null,"previous_names":["estaji/useful-bash-scripts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estaji%2Fuseful-bash-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estaji%2Fuseful-bash-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estaji%2Fuseful-bash-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estaji%2Fuseful-bash-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estaji","download_url":"https://codeload.github.com/estaji/useful-bash-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244165788,"owners_count":20409149,"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":["bash","bash-script"],"created_at":"2025-03-18T05:32:21.053Z","updated_at":"2025-10-30T17:34:44.401Z","avatar_url":"https://github.com/estaji.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\nIt is a group of **useful shell scripts** for DevOps engineers, System administrators, and developers.\n\n# How\nEach script has a different purpose and scripts are not related to each other.\nFind a useful script from this readme file then use it.\n\n# List\n+ try_interval.sh\n+ bulk_commands.sh\n+ backup_ftp.sh\n+ incremental-backup-smb.sh\n+ remove_old_created_files.sh\n+ archive-to-minio-using-mc.sh\n+ backup-dockerized-postgresql-to-smb.sh\n+ backup-website-files-and-db-to-smb.sh\n+ dump-postgresql-db-then-rsync.sh\n+ dump-dockerized-psql-db-then-rsync.sh\n+ bulk-delete-helm-release-and-namespace.sh\n+ setup-rbash-for-a-user.sh\n\n### try_interval.sh\nTry to execute a command until a successful result or reach a limitation in the number of *tries* based on an *interval time* between each try.\n\nExample:\n\n#./try_interval.sh -i 6 -n 3 mycommand\n\n### bulk_commands.sh\nExecute the same command for all lines of a file as input.\n\nFor example, we have an IPs.txt file and each line of the file has an IP address. We want to allow all IPs to use iptables command. So we run:\n\n#sudo ./bulk_commands.sh -f cdnips.txt iptables -A INPUT -s PARM -j ACCEPT\n\nPARM is replaced by each line of the file (which contains an IP address in this example)\n\n### backup_ftp.sh\nCreate a tar.gz file from a given directory, then upload it to an ftp backup storage.\nIf your backup storage supports secure protocols/methods (e.g: rsync/scp/sftp/...), you should use another method instead of FTP.\nYou can use FTP_STORAGE_PASS environment variable instead of -p option.\n\nExample usage:\n\n#backup_ftp.sh -d /home/myuser/myfiles/ -o /tmp/backups/bkp-$(date '+%Y-%m-%d-%H-%M-%S').tar.gz -u b110973 -f b110973.myftpserver.org -p f67Eex1JsfR8bB -r\n\n### incremental-backup-smb.sh\nCreate an incremental backup (using rsync) on each execution (for example the script is triggered by a cronjob) and create a full (tar) backup on a specific day of week and hour (which the cronjob runs at).\n\nThe destination is an SMB server.\n\nCreate the mount point destination manually before execution. Also, configure variables in the next step.\n\n### remove_old_created_files.sh\nFind old created files (older than REMOVER_PAST_DAYS variable) and delete them.\n\nChange REMOVER_DIR, REMOVER_PAST_DAYS and REMOVER_TODAY variables then use.\n\n### archive-to-minio-using-mc.sh\nArchive files or backups in a MinIO bucket. This script ensures today's backup existence, uploads it to the bucket and then removes the oldest file (based on BKP_OLD_DATE variable) locally and remotely. requirements:\n\n1. mc command as minio client\n2. create an Alias for your bucket in mc command (https://min.io/docs/minio/linux/reference/minio-mc.html)\n\n### backup-dockerized-postgresql-to-smb.sh\nCreate dump from a dockerized PostgreSQL database and save it locally, then upload it to a SMB storage.\n\nTested on Rocky 8, Please check commands (like /usr/bin/time -f %e) on another OS.\n\n### backup-website-files-and-db-to-smb.sh\nCreate dump from a mysql database and compress website files, then mount a SMB storage and copy the backup to it.\n\n### dump-postgresql-db-then-rsync.sh\nCreate dump from a Postgresql database. Then transfer the dump to a remote server using rsync.\n\n### dump-dockerized-psql-db-then-rsync.sh\nCreate dump from a dockerized Postgresql database. Then transfer the dump to a remote server using rsync.\n\n### bulk-delete-helm-release-and-namespace.sh\nThis script do helm uninstall on a certain pattern namespaces (like *-dev in this example) and then delete those namespaces on a Kubernetes cluster.\n\n### setup-rbash-for-a-user.sh\nThis script setups RBASH for a user that is already created and just allow the user to use certain limited commands.\nFor example you can create a user with only rsync access to transfer log files and it does not have any other commands and access.\n\n# Contribution\nFeel free and don't hesitate to contribute to this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festaji%2Fuseful-bash-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festaji%2Fuseful-bash-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festaji%2Fuseful-bash-scripts/lists"}