{"id":19593389,"url":"https://github.com/jibres/linux-auto-backup","last_synced_at":"2026-04-17T15:03:08.992Z","repository":{"id":109773287,"uuid":"351276362","full_name":"jibres/linux-auto-backup","owner":"jibres","description":"Automatic backup from everything in Linux include MySQL + configs + files and transfer them to another server + s3 storage","archived":false,"fork":false,"pushed_at":"2022-08-10T16:38:39.000Z","size":54,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-09T06:53:16.550Z","etag":null,"topics":["autobackup","automation","backup","backup-script","backup-solution","mysql","mysql-backup","mysqldump","rsync","rsync-backup","s3","s3-backup"],"latest_commit_sha":null,"homepage":"https://blog.mradib.com/linux-auto-backup","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/jibres.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2021-03-25T01:45:11.000Z","updated_at":"2024-08-03T22:59:19.000Z","dependencies_parsed_at":"2023-06-11T17:15:25.634Z","dependency_job_id":null,"html_url":"https://github.com/jibres/linux-auto-backup","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibres%2Flinux-auto-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibres%2Flinux-auto-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibres%2Flinux-auto-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibres%2Flinux-auto-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jibres","download_url":"https://codeload.github.com/jibres/linux-auto-backup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240867431,"owners_count":19870405,"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":["autobackup","automation","backup","backup-script","backup-solution","mysql","mysql-backup","mysqldump","rsync","rsync-backup","s3","s3-backup"],"created_at":"2024-11-11T08:39:21.910Z","updated_at":"2026-04-17T15:03:08.880Z","avatar_url":"https://github.com/jibres.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux Auto Backup\nAutomatic backup from everything in your linux include MySQL, files and configs and transfer them to another server + s3 storage\n\nYou can follow these steps to take a backup from your database and transfer them to safe place outside of this server. then put it inside cronjob to do it periodically.\nFirst login to your server, we are use Ubuntu.\n\n\n\n## create a readonly user for backup\nenter your mysql root password or some other user. change username if you want and enter your password\n1. ```sudo mysql -u root -p```\n2. ```CREATE USER 'dumper'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PUT_YOUR_PASSWORD_HERE';```\n3. ```GRANT SELECT, PROCESS, LOCK TABLES ON *.* TO 'dumper'@'localhost';```\n4. ```flush privileges;```\n5. ```exit;```\n\n\nAlso as alternative way, you can insert user via phpmyadmin. check only needed permission for create readonly user\n![image](https://user-images.githubusercontent.com/8861284/111926849-1843f380-8acc-11eb-8245-183e3c5654ea.png)\n\n\n\n## save user and password of dump user for mysql\nopen or create mysql public conf file\n\n```sudo nano ~/.my.cnf```\n\ncopy and paste below text and update username and password if needed\n\n```\n[mysqldump]\nuser=dumper\npassword=PUT_YOUR_PASSWORD_HERE\n```\nPress `ctrl+x` then press `y` to save file and exit\n\n\n## Setup File Mirroring Using Rsync\nTo sync your files from server A (main) to server B (backup), follow these steps.\n\n### install rsync\nInstall rsync on both server A and server B.\n\n```apt-get install rsync```\n\n### Generate an SSH key\nRun the following command to generate an SSH key.\n\n```ssh-keygen```\n\nPress enter to skip all inputs.\n\n### Save auto login to target server\n\n```ssh-copy-id root@1.2.3.4```\n\npress yes and enter password of target server. you can change user to anything\n\n\n## Setup S3 cmd\nIf you want to use s3 storage fro backup you need to install s3 cmd tools with below command\n\n```apt-get install s3cmd```\n\nAfter install, you need to config it with below command\n\n```s3cmd --configure```\n\non config ask you below detail\n\n1. Access Key\n2. Secret Key\n3. Default Region (press enter)\n4. S3 Endpoint (give it from your s3 service something like fra1.digitaloceanspaces.com)\n5. DNS-Style template (like previous)\n6. Encryption password (press enter)\n7. Path to GPG program (press enter)\n8. use HTTPS (type `Yes` and press enter)\n9. Http Proy server name (press enter)\n10. Test access (type `Y` and press enter)\n11. if Success, ask for save setting. type `y` and press enter\n\n\n## Test sync command manually\non start before backup database, it's good idea to run sync process manually. on first run it was sync files already exist.\n\nfirst you need to enter your config file for your server. fo to `conf` folder. create a copy from `conf/config.yaml` and rename it to your server name. it must seems like `config[MY_SERVER_NAME].me.yaml`.\nopen this file and edit. enable server backup or s3 storage.\n\nafter enter your config for this server run below command.\n\n```bash sync-changes.sh```\n\nthen wait until transfer all exist files to backup server and s3 storage. on next step take we are add them into cronjob\n\n\n\n\n## Setup cronjob\nSetup a cronjob to sync your files automatically.\n\n```crontab -e```\n\npaste below line to run bash. first line run every one hour. second run every day on 3:30. third run every 1st day of month on 4:30\n\n```\n0 * * * * /bin/bash /home/linux-auto-backup/backup-hourly+sync.sh \u003e/dev/null 2\u003e\u00261\n30 3 * * * /bin/bash /home/linux-auto-backup/backup-daily.sh \u003e/dev/null 2\u003e\u00261\n30 4 1 * * /bin/bash /home/linux-auto-backup/backup-monthly.sh \u003e/dev/null 2\u003e\u00261\n```\n\nif on this server you don't have database and only need to backup from files you can set below cmd\n\n```0 * * * * /bin/bash /home/linux-auto-backup/sync-changes.sh \u003e/dev/null 2\u003e\u00261```\n\nif you wand to debug result you can send log into file with below command\n\n```* * * * * /bin/bash /home/linux-auto-backup/backup-hourly+sync.sh \u003e /home/linux-auto-backup/log/cronjob.log 2\u003e\u00261```\n\npress `ctrl+x` then press `y` to save file and exit\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjibres%2Flinux-auto-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjibres%2Flinux-auto-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjibres%2Flinux-auto-backup/lists"}