{"id":343,"date":"2009-11-27T08:29:56","date_gmt":"2009-11-27T08:29:56","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2009\/11\/27\/solaris-backup-script\/"},"modified":"2021-07-31T17:36:30","modified_gmt":"2021-07-31T17:36:30","slug":"solaris-backup-script","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html","title":{"rendered":"Solaris Backup Script"},"content":{"rendered":"

This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful backup and rotate the backups to ensure you dont run into disk space issues.<\/p>\n

#!\/sbin\/sh\r\n##\r\n## SunOS Backup Script v1.3\r\n##\r\n## Backups up the the following file to \/var\/tmp\/solaris-backup_`hostname`_`\/bin\/date +\"%Y%m%d\"`.tgz\r\n## \r\n## \/etc\/passwd \r\n## \/etc\/system\r\n## \/etc\/group \r\n## \/etc\/shadow \r\n## \/etc\/syslog.conf \r\n## \/etc\/nsswitch.conf \r\n## \/etc\/hosts \r\n## \/etc\/nodename \r\n## \/etc\/hostname.* \r\n## \/etc\/etheraddr* \r\n## \/etc\/inet\/netmasks \r\n## \/etc\/inet\/ntp.conf \r\n## \/etc\/rc3.d\/* \r\n## \/etc\/init.d\/* \r\n## \/etc\/ssh \r\n## \/var\/spool\/cron \r\n## \/usr\/local\/bin \r\n## \/usr\/local\/log \r\n## \/var\/tmp\/`hostname`_runconfig_`date +\"%Y%m%d\"`.txt = arp -an \/ ifconfig -a \/ netstat -nvr\r\n##\r\n\r\n## ENV VARIABLES\r\n\r\nif [ -r \/.profile ]\r\nthen\r\n\t. \/.profile\r\nelse\r\n\texit 1\t \r\nfi\r\n\r\n## VARIABLES\r\n\r\nBKUPFILE=\/var\/tmp\/solaris-backup_`hostname`_`date +\"%Y%m%d\"`.tgz\r\n\r\n## Backup Rotatation\r\n\r\nfind \/var\/tmp\/ -name *backup\\* -mtime +2 -exec rm {} \\;\r\n \r\n## BACKUP\r\n\r\nif [ `uname` = SunOS ] \r\nthen\r\n\r\n  arp -an > \/var\/tmp\/`hostname`_runconfig_`date +\"%Y%m%d\"`.txt\r\n  netstat -rvn >> \/var\/tmp\/`hostname`_runconfig_`date +\"%Y%m%d\"`.txt\r\n  ifconfig -a >> \/var\/tmp\/`hostname`_runconfig_`date +\"%Y%m%d\"`.txt\r\n  \ttar -cf - \/etc\/passwd \/etc\/system \/etc\/group \/etc\/shadow \/etc\/syslog.conf \/etc\/nsswitch.conf \/etc\/hosts \/etc\/nodename \/etc\/hostname.* \/etc\/etheraddr* \/etc\/inet\/netmasks \/etc\/inet\/ntp.conf \/etc\/rc3.d\/* \/etc\/init.d\/* \/etc\/ssh \/var\/tmp\/`hostname`_runconfig_`date +\"%Y%m%d\"`.txt \/var\/spool\/cron \/usr\/local\/bin \/usr\/local\/log 2>\/dev\/null | gzip -6c > \"${BKUPFILE}\"      \r\n  \tRC=$?\r\n  rm -f \/var\/tmp\/`hostname`_runconfig_`date +\"%Y%m%d\"`.txt\r\n  MD5=`md5 \"${BKUPFILE}\"`\r\nelse\r\n  logger -t cp_backup -p daemon.err \"Backup unsuccessful. Wrong OS.\"\r\nfi\r\n\r\n## LOGGING\r\n\r\nif [ \"${RC}\" != 0 ]\r\nthen\r\n        logger -t cp_backup -p daemon.err \"Backup unsuccessful.\"\r\n\texit 1\r\n\r\nelif [ \"${RC}\" = 0 ]\r\nthen\r\n        logger -t cp_backup -p notice \"Backup successful. \"${MD5}\"\"\r\n\texit 0\r\nfi\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful backup and rotate the backups to ensure you dont run into disk space issues. #!\/sbin\/sh ## ## SunOS Backup Script v1.3 ## ## Backups up the the following … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"yoast_head":"\nSolaris Backup Script - Fir3net<\/title>\n<meta name=\"description\" content=\"This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Solaris Backup Script - Fir3net\" \/>\n<meta property=\"og:description\" content=\"This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\" \/>\n<meta property=\"og:site_name\" content=\"Fir3net\" \/>\n<meta property=\"article:published_time\" content=\"2009-11-27T08:29:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-31T17:36:30+00:00\" \/>\n<meta name=\"author\" content=\"Rick Donato\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rick Donato\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\"},\"author\":{\"name\":\"Rick Donato\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\"},\"headline\":\"Solaris Backup Script\",\"datePublished\":\"2009-11-27T08:29:56+00:00\",\"dateModified\":\"2021-07-31T17:36:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\"},\"wordCount\":45,\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"articleSection\":[\"Shell Scripting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\",\"url\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\",\"name\":\"Solaris Backup Script - Fir3net\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/#website\"},\"datePublished\":\"2009-11-27T08:29:56+00:00\",\"dateModified\":\"2021-07-31T17:36:30+00:00\",\"description\":\"This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful\",\"breadcrumb\":{\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.fir3net.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming\",\"item\":\"https:\/\/www.fir3net.com\/programming\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Shell Scripting\",\"item\":\"https:\/\/www.fir3net.com\/programming\/shell-scripting\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Solaris Backup Script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.fir3net.com\/#website\",\"url\":\"https:\/\/www.fir3net.com\/\",\"name\":\"Fir3net\",\"description\":\"Keeping you in the know\",\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.fir3net.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.fir3net.com\/#organization\",\"name\":\"Fir3net\",\"url\":\"https:\/\/www.fir3net.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"contentUrl\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"width\":390,\"height\":88,\"caption\":\"Fir3net\"},\"image\":{\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\",\"name\":\"Rick Donato\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"caption\":\"Rick Donato\"},\"description\":\"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Solaris Backup Script - Fir3net","description":"This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html","og_locale":"en_US","og_type":"article","og_title":"Solaris Backup Script - Fir3net","og_description":"This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful","og_url":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html","og_site_name":"Fir3net","article_published_time":"2009-11-27T08:29:56+00:00","article_modified_time":"2021-07-31T17:36:30+00:00","author":"Rick Donato","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rick Donato","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html#article","isPartOf":{"@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html"},"author":{"name":"Rick Donato","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037"},"headline":"Solaris Backup Script","datePublished":"2009-11-27T08:29:56+00:00","dateModified":"2021-07-31T17:36:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html"},"wordCount":45,"publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"articleSection":["Shell Scripting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html","url":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html","name":"Solaris Backup Script - Fir3net","isPartOf":{"@id":"https:\/\/www.fir3net.com\/#website"},"datePublished":"2009-11-27T08:29:56+00:00","dateModified":"2021-07-31T17:36:30+00:00","description":"This script will backup all the major operating system files and save them within \/var\/tmp. It was also log the MD5 of the backup after each successful","breadcrumb":{"@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/solaris-backup-script.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fir3net.com\/"},{"@type":"ListItem","position":2,"name":"Programming","item":"https:\/\/www.fir3net.com\/programming"},{"@type":"ListItem","position":3,"name":"Shell Scripting","item":"https:\/\/www.fir3net.com\/programming\/shell-scripting"},{"@type":"ListItem","position":4,"name":"Solaris Backup Script"}]},{"@type":"WebSite","@id":"https:\/\/www.fir3net.com\/#website","url":"https:\/\/www.fir3net.com\/","name":"Fir3net","description":"Keeping you in the know","publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fir3net.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.fir3net.com\/#organization","name":"Fir3net","url":"https:\/\/www.fir3net.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","contentUrl":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","width":390,"height":88,"caption":"Fir3net"},"image":{"@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037","name":"Rick Donato","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","caption":"Rick Donato"},"description":"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders."}]}},"_links":{"self":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/343"}],"collection":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":0,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}