{"id":2507,"date":"2019-04-09T06:11:17","date_gmt":"2019-04-09T06:11:17","guid":{"rendered":"http:\/\/kedar.nitty-witty.com\/?p=2507"},"modified":"2024-01-27T17:28:26","modified_gmt":"2024-01-27T17:28:26","slug":"mysql-database-backup-shell-script-with-status-email","status":"publish","type":"post","link":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email","title":{"rendered":"MySQL backup shell script with status email"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This post is for the backup script for MySQL database on Linux with mail. It&#8217;s a linux shell script for taking logical backup using mysqldump and sending status email.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The backup shell script works as follows:<br>&#8211; The script takes backup using mysqldump and compresses it.<br>&#8211; Upon success, it will attempt to ship the backup to specified offsite location.<br>&#8211; Upon detecting failure in any of the above step, it will send out failure email.<br>&#8211; Upon overall success, it will sendout success email with execution time and present backups list.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>You might be looking for setting up physical <a href=\"http:\/\/kedar.nitty-witty.com\/setup-and-configure-mysql-backup-using-holland-and-xtrabackup\" target=\"_blank\" rel=\"noopener noreferrer\">backups for mysql using Holland backup framework<\/a>.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Following is the code for MySQL backup shell script using mysqldump with status email.<\/p>\n\n\n\n<!--more-->\n\n\n\n<pre class=\"wp-block-code\"><code>\n#\/bin\/bash\n## Script: \n# Backup script to take mysqldump\n# Retain 7 days of backup\n# Move backup to offsite\n# Send success\/failure email\n## http:\/\/kedar.nitty-witty.com\n## Ver.1 2018-01-20\n#  set up all the mysqldump variables\nFILE=database.sql.`date +\"%Y%m%d\"`.gz\nDBSERVER=127.0.0.1\nREMOTE_SERVER=127.0.0.1 # move database to offsite for backup\nDATABASE=dbname\nDBUSER=backup_user\nPASS=s3cr3tp@ssw0rd\n\nSRC_DIR=\/home\/admin\/script\nREMOTE_BACKUP_DIR=\/root\/mysql\/backup\nNOW=`date \"+%Y%m%d-%H%M\"`\nemail_list=\"kedar@nitty-witty.com\"\nsuccess_email=\"kedar+success@nitty-witty.com\"\nfailure_email=\"kedar+failure@nitty-witty.com\";\nSTART=$(date +%s)\n\n# function to send backup status email\nsendEmail() {\n        scripttime=0;\n        END=$(date +%s)\n        DIFF=$(( $END - $START ))\n        if &#91; $DIFF -le 60 ]; then\n                scripttime=\"$DIFF seconds.\";\n        else\n                DIFF=$(( $DIFF \/ 60 ))\n                scripttime=\"$DIFF minutes.\";\n        fi;\n        content=\"$content. Log: Backup duration: $scripttime\"\n        echo $content  | mail -s \"$subject\"  $email_list\n        exit;\n}\n\n# pipeline will return failure code if the mysqldump command fails\nset -o pipefail\n# Taking backup of all databases\nmysqldump --opt --user=${DBUSER} --password=${PASS} --no-data --single-transaction --all-databases | gzip &gt; ${SRC_DIR}\/${FILE} 2&gt;\/dev\/null\n\n# Verify backup is success\/failure\nRESULT=$?\nif &#91; $RESULT -ne 0 ]; then\n        subject=\"Backup-FAILURE\";\n        content=\"Backup appears to have been failed for $NOW. The mysqldump command returned failure status. Please login to $DBSERVER and check the status.\"\n        email_list=$failure_email\n        echo \"&#91;`date`]Backup failure.\"\n        sendEmail\nfi\n\n# Transfer to remote host\nscp ${SRC_DIR}\/${FILE} root@${REMOTE_SERVER}:${REMOTE_BACKUP_DIR} 2&gt;\/dev\/null\nRESULT=$?\nif &#91; $RESULT -ne 0 ]; then\n        subject=\"Backup-FAILURE\";\n        content=\"Backup appears to have been completed for $NOW. But SCP to remote server failed.\"\n        email_list=$failure_email\n        echo \"&#91;`date`]SCP failure.\"\n        sendEmail\nfi\n\n# Delete 7 days old file from remote host\nBACKUP_FILE=${REMOTE_BACKUP_DIR}\/database.sql.`date -d\"-7 days\" +\"%Y%m%d\"`.gz 2&gt;\/dev\/null\n# in case you run this more than once a day, remove the previous version of the file\necho \"&#91;`date`] Removing backup file: $BACKUP_FILE from ${REMOTE_SERVER}.\"\nssh root@${REMOTE_SERVER} \"rm $BACKUP_FILE\" 2&gt;\/dev\/null\n\n# Keep only last 7 days worth backup on database server.\nfind $SRC_DIR -mtime +7 -name '*.gz' -exec rm {} \\;\n\n# Finally send successful backup completion email.\nsubject=\"Backup-SUCCESS\"\ncontent=\"The backup file is on database server $SRC_DIR\/$FILE. Remote location is Backup ${REMOTE_SERVER}:$REMOTE_BACKUP_DIR is successful.\"\ncontent=$content.`ls -lhtr $SRC_DIR\/ | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,\"\\r\"}'`\nemail_list=$success_email;\necho \"&#91;`date`]Backup Success.\"\nsendEmail\nexit 0;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You may also choose to fork it on my Github repo.<\/p>\n","protected":false},"excerpt":{"rendered":"This post is for the backup script for MySQL database on Linux with mail. It&#8217;s a linux shell script for taking logical backup using mysqldump and sending status email. The&hellip;\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8,870,377,6],"tags":[473,475,474,76,476,477],"class_list":["post-2507","post","type-post","status-publish","format-standard","category-mysql","category-mysql-tools","category-mysql-articles","category-technical","tag-backup-script-with-status-email","tag-mysql-backup","tag-mysql-backup-script-and-send-email","tag-mysqldump","tag-mysqldump-shell-script","tag-shell-script-send-email"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"This post is for the backup script for MySQL database on Linux with mail. It&#039;s a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Kedar\"\/>\n\t<meta name=\"google-site-verification\" content=\"_Bu1h5r0PxIC0D2jBVdmYN45RTeG9ogcX85XLkbG1qA\" \/>\n\t<meta name=\"msvalidate.01\" content=\"116B62074CBCA1BA99B8CCE09CCF2FB8\" \/>\n\t<meta name=\"keywords\" content=\"backup script with status email,mysql backup,mysql backup script and send email,mysqldump,mysqldump shell script,shell script send email\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Change Is Inevitable | Kedar Vaijanapurkar&#039;s Blog for MySQL, technology and various subjects\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"MySQL backup shell script with status email | Change Is Inevitable\" \/>\n\t\t<meta property=\"og:description\" content=\"This post is for the backup script for MySQL database on Linux with mail. It&#039;s a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-04-09T06:11:17+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-01-27T17:28:26+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"MySQL backup shell script with status email | Change Is Inevitable\" \/>\n\t\t<meta name=\"twitter:description\" content=\"This post is for the backup script for MySQL database on Linux with mail. It&#039;s a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#article\",\"name\":\"MySQL backup shell script with status email | Change Is Inevitable\",\"headline\":\"MySQL backup shell script with status email\",\"author\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kedar\"},\"datePublished\":\"2019-04-09T06:11:17+00:00\",\"dateModified\":\"2024-01-27T17:28:26+00:00\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#webpage\"},\"articleSection\":\"MySQL, MySQL tools, MySQL-Articles, Technical, backup script with status email, mysql backup, mysql backup script and send email, mysqldump, mysqldump shell script, shell script send email\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql#listItem\",\"name\":\"MySQL\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql#listItem\",\"position\":2,\"name\":\"MySQL\",\"item\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-articles#listItem\",\"name\":\"MySQL-Articles\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-articles#listItem\",\"position\":3,\"name\":\"MySQL-Articles\",\"item\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-articles\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#listItem\",\"name\":\"MySQL backup shell script with status email\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql#listItem\",\"name\":\"MySQL\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#listItem\",\"position\":4,\"name\":\"MySQL backup shell script with status email\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-articles#listItem\",\"name\":\"MySQL-Articles\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#person\",\"name\":\"Kedar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kedar\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\",\"url\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin\",\"name\":\"Kedar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kedar\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#webpage\",\"url\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email\",\"name\":\"MySQL backup shell script with status email | Change Is Inevitable\",\"description\":\"This post is for the backup script for MySQL database on Linux with mail. It's a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/mysql-database-backup-shell-script-with-status-email#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\"},\"datePublished\":\"2019-04-09T06:11:17+00:00\",\"dateModified\":\"2024-01-27T17:28:26+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/\",\"name\":\"..::CHANGE is INEVITABLE::..\",\"description\":\"Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"MySQL backup shell script with status email | Change Is Inevitable","description":"This post is for the backup script for MySQL database on Linux with mail. It's a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to","canonical_url":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email","robots":"max-image-preview:large","keywords":"backup script with status email,mysql backup,mysql backup script and send email,mysqldump,mysqldump shell script,shell script send email","webmasterTools":{"google-site-verification":"_Bu1h5r0PxIC0D2jBVdmYN45RTeG9ogcX85XLkbG1qA","msvalidate.01":"116B62074CBCA1BA99B8CCE09CCF2FB8","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#article","name":"MySQL backup shell script with status email | Change Is Inevitable","headline":"MySQL backup shell script with status email","author":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author"},"publisher":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kedar"},"datePublished":"2019-04-09T06:11:17+00:00","dateModified":"2024-01-27T17:28:26+00:00","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#webpage"},"isPartOf":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#webpage"},"articleSection":"MySQL, MySQL tools, MySQL-Articles, Technical, backup script with status email, mysql backup, mysql backup script and send email, mysqldump, mysqldump shell script, shell script send email"},{"@type":"BreadcrumbList","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/kedar.nitty-witty.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql#listItem","name":"MySQL"}},{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql#listItem","position":2,"name":"MySQL","item":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql","nextItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-articles#listItem","name":"MySQL-Articles"},"previousItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-articles#listItem","position":3,"name":"MySQL-Articles","item":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-articles","nextItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#listItem","name":"MySQL backup shell script with status email"},"previousItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql#listItem","name":"MySQL"}},{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#listItem","position":4,"name":"MySQL backup shell script with status email","previousItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-articles#listItem","name":"MySQL-Articles"}}]},{"@type":"Person","@id":"https:\/\/kedar.nitty-witty.com\/blog\/#person","name":"Kedar","image":{"@type":"ImageObject","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kedar"}},{"@type":"Person","@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author","url":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin","name":"Kedar","image":{"@type":"ImageObject","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kedar"}},{"@type":"WebPage","@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#webpage","url":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email","name":"MySQL backup shell script with status email | Change Is Inevitable","description":"This post is for the backup script for MySQL database on Linux with mail. It's a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email#breadcrumblist"},"author":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author"},"creator":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author"},"datePublished":"2019-04-09T06:11:17+00:00","dateModified":"2024-01-27T17:28:26+00:00"},{"@type":"WebSite","@id":"https:\/\/kedar.nitty-witty.com\/blog\/#website","url":"https:\/\/kedar.nitty-witty.com\/blog\/","name":"..::CHANGE is INEVITABLE::..","description":"Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects","inLanguage":"en-US","publisher":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/#person"}}]},"og:locale":"en_US","og:site_name":"Change Is Inevitable | Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects","og:type":"article","og:title":"MySQL backup shell script with status email | Change Is Inevitable","og:description":"This post is for the backup script for MySQL database on Linux with mail. It's a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to","og:url":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email","article:published_time":"2019-04-09T06:11:17+00:00","article:modified_time":"2024-01-27T17:28:26+00:00","twitter:card":"summary","twitter:title":"MySQL backup shell script with status email | Change Is Inevitable","twitter:description":"This post is for the backup script for MySQL database on Linux with mail. It's a linux shell script for taking logical backup using mysqldump and sending status email. The backup shell script works as follows:- The script takes backup using mysqldump and compresses it.- Upon success, it will attempt to ship the backup to"},"aioseo_meta_data":{"post_id":"2507","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"MySQL Backup","score":76,"analysis":{"keyphraseInTitle":{"score":9,"maxScore":9,"error":0},"keyphraseInDescription":{"score":9,"maxScore":9,"error":0},"keyphraseLength":{"score":9,"maxScore":9,"error":0,"length":2},"keyphraseInURL":{"score":1,"maxScore":5,"error":1},"keyphraseInIntroduction":{"score":3,"maxScore":9,"error":1},"keyphraseInSubHeadings":[],"keyphraseInImageAlt":[]}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-24 17:39:53","updated":"2025-08-16 19:17:35","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/kedar.nitty-witty.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\" title=\"MySQL\">MySQL<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-articles\" title=\"MySQL-Articles\">MySQL-Articles<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMySQL backup shell script with status email\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/kedar.nitty-witty.com\/blog"},{"label":"MySQL","link":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql"},{"label":"MySQL-Articles","link":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-articles"},{"label":"MySQL backup shell script with status email","link":"https:\/\/kedar.nitty-witty.com\/blog\/mysql-database-backup-shell-script-with-status-email"}],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/2507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/comments?post=2507"}],"version-history":[{"count":8,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/2507\/revisions"}],"predecessor-version":[{"id":2848,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/2507\/revisions\/2848"}],"wp:attachment":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/media?parent=2507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/categories?post=2507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/tags?post=2507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}