{"id":927,"date":"2015-01-22T16:57:17","date_gmt":"2015-01-22T21:57:17","guid":{"rendered":"https:\/\/www.softwareab.net\/wordpress\/?p=927"},"modified":"2015-01-22T17:00:46","modified_gmt":"2015-01-22T22:00:46","slug":"backup-dell-2824-switch-command-line","status":"publish","type":"post","link":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/","title":{"rendered":"Backup a Dell 2824 Switch from Command Line"},"content":{"rendered":"<p>Hi All &#8211; ever need to backup your Dell 2824 Managed Switch? If so&#8230;you know that the only way to do this is by the Web UI. Which isn&#8217;t very helpful if you want to keep your switch configuration backed up automatically. Read on for our solution!<\/p>\n<p><!--more--><\/p>\n<p><em><strong>Impatient?<\/strong> Me, too&#8230;to just Get the Code <a href=\"\/wordpress\/wp-content\/uploads\/2015\/01\/sab-dell2824-backup-sh.txt\">download sab-dell2824-backup-sh.txt here<\/a>. Then rename it to <code>sab-dell2824-backup.sh<\/code> and whale away with it. Have fun!<\/em><\/p>\n<p>Today&#8217;s article addresses a shortcoming in the <a href=\"http:\/\/www.dell.com\/us\/business\/p\/powerconnect-2800\/pd\">Dell 2824 SMB workgroup switch<\/a>. While these are nice enough machines &#8211; VLAN tags (802.1Q), auto-negotiation, and port bonding come to mind &#8211; they do *not* have a very good command line interface (CLI). While a rudimentary CLI does exist, it&#8217;s missing both <code>show running-config<\/code> and <code>copy running-config [tftp:\/\/dest]<\/code>. (Not to mention that the CLI can only be connected to using <code>telnet<\/code> &#8211; eck.)<\/p>\n<p>However, I have some of these beasts under my purview so I must manage them. And when they are managed I want backups &#8211; without depending on an admin to login to the switch and use the &#8220;File Upload&#8221; menu command.<\/p>\n<p>So I finally sat down and wrote the code to do this. It&#8217;s all in <code>bash<\/code> and uses <a href=\"http:\/\/curl.haxx.se\/\">curl<\/a>. Let&#8217;s get down to it.<\/p>\n<h3>Approach<\/h3>\n<p>Working directly with curl is a pain when state is involved. You need to make sure you can keep session variables alive, map referrals properly, and differentiate between GET and POST. Also &#8211; because there is no JavaScript engine involved &#8211; any &#8220;interaction&#8221; with the site in question has to be handled by reading the returned HTML, parsing out fields, and making additional requests as necessary.<\/p>\n<p>To handle this, I do the following:<\/p>\n<ul>\n<li>Treat each part of the interaction separately. I create necessary work files with a number to clearly indicate the processing order.<\/li>\n<li>Drive everything from variables. You&#8217;ll notice in the below that almost all of the variables passed to curl are defined in the shell script&#8217;s configuration section. That&#8217;s to isolate changes as much as possible.<\/li>\n<li>Account for errors. Actually, in the script as I have it there&#8217;s not that much error checking. I depend on curl for most operations, and keep my own error checking to a minimum. I would do more error checking but the script just ended up taking too much time. Perhaps some other person will be inspired to improve it?<\/li>\n<\/ul>\n<p>Rather than writing a tome on shell script processing, I&#8217;ll just present the code as-is. Hope it&#8217;s useful!<\/p>\n<p>Here&#8217;s some expected output:<\/p>\n<pre><code>\r\n[root@mysrv foo]# <strong>.\/sab-dell2824-backup.sh<\/strong>\r\n<em>Logging in to Dell2824...OK\r\nConfigure switch for logged-in user...OK\r\nFinishing session setup for logged-in user...OK\r\nChecking switch copy history...OK\r\nQuerying switch for download instructions...OK (index: 84)\r\nDownloading switch configuration via HTTP to 'Dell2824-config-20150122.cfg'...OK (6745 bytes)\r\nChecking to see if we got a good download...OK (6745 bytes)\r\nChecking switch copy history...delete index 84...OK\r\nLogging out of Dell2824...OK<\/em>\r\n<\/code><\/pre>\n<p>That is all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi All &#8211; ever need to backup your Dell 2824 Managed Switch? If so&#8230;you know that the only way to do this is by the Web UI. Which isn&#8217;t very helpful if you want to keep your switch configuration backed &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\"> <span class=\"screen-reader-text\">Backup a Dell 2824 Switch from Command Line<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[81,1],"tags":[42,22,18],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Backup a Dell 2824 Switch from Command Line - softwareab<\/title>\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.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Backup a Dell 2824 Switch from Command Line - softwareab\" \/>\n<meta property=\"og:description\" content=\"Hi All &#8211; ever need to backup your Dell 2824 Managed Switch? If so&#8230;you know that the only way to do this is by the Web UI. Which isn&#8217;t very helpful if you want to keep your switch configuration backed &hellip; Backup a Dell 2824 Switch from Command Line Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"softwareab\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cloudraticsolutions\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/cloudraticsolutions\/\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-22T21:57:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-01-22T22:00:46+00:00\" \/>\n<meta name=\"author\" content=\"Andrew Bruce\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@realcloudratics\" \/>\n<meta name=\"twitter:site\" content=\"@realcloudratics\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Bruce\" \/>\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.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\"},\"author\":{\"name\":\"Andrew Bruce\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\"},\"headline\":\"Backup a Dell 2824 Switch from Command Line\",\"datePublished\":\"2015-01-22T21:57:17+00:00\",\"dateModified\":\"2015-01-22T22:00:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\"},\"wordCount\":419,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\"},\"keywords\":[\"centos\",\"scripting\",\"sysadmin\"],\"articleSection\":[\"SysAdmin\",\"Teknocratica\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\",\"url\":\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\",\"name\":\"Backup a Dell 2824 Switch from Command Line - softwareab\",\"isPartOf\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#website\"},\"datePublished\":\"2015-01-22T21:57:17+00:00\",\"dateModified\":\"2015-01-22T22:00:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.softwareab.net\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"centos\",\"item\":\"https:\/\/www.softwareab.net\/wordpress\/tag\/centos\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Backup a Dell 2824 Switch from Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#website\",\"url\":\"https:\/\/www.softwareab.net\/wordpress\/\",\"name\":\"softwareab\",\"description\":\"Technocratica, Technopolitik, Technophobia\",\"publisher\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.softwareab.net\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\",\"name\":\"Andrew Bruce\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg\",\"contentUrl\":\"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg\",\"width\":400,\"height\":330,\"caption\":\"Andrew Bruce\"},\"logo\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/\"},\"description\":\"Team-oriented systems mentor with deep knowledge of numerous software methodologies, technologies, languages, and operating systems. Excited about turning emerging technology into working production-ready systems. Focused on moving software teams to a higher level of world-class application development. Specialties:Software analysis and development...Product management through the entire lifecycle...Discrete product integration specialist!\",\"sameAs\":[\"http:\/\/cloudraticsolutions.net\/\",\"https:\/\/www.facebook.com\/cloudraticsolutions\/\",\"https:\/\/twitter.com\/realcloudratics\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Backup a Dell 2824 Switch from Command Line - softwareab","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.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/","og_locale":"en_US","og_type":"article","og_title":"Backup a Dell 2824 Switch from Command Line - softwareab","og_description":"Hi All &#8211; ever need to backup your Dell 2824 Managed Switch? If so&#8230;you know that the only way to do this is by the Web UI. Which isn&#8217;t very helpful if you want to keep your switch configuration backed &hellip; Backup a Dell 2824 Switch from Command Line Read More &raquo;","og_url":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/","og_site_name":"softwareab","article_publisher":"https:\/\/www.facebook.com\/cloudraticsolutions\/","article_author":"https:\/\/www.facebook.com\/cloudraticsolutions\/","article_published_time":"2015-01-22T21:57:17+00:00","article_modified_time":"2015-01-22T22:00:46+00:00","author":"Andrew Bruce","twitter_card":"summary_large_image","twitter_creator":"@realcloudratics","twitter_site":"@realcloudratics","twitter_misc":{"Written by":"Andrew Bruce","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#article","isPartOf":{"@id":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/"},"author":{"name":"Andrew Bruce","@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600"},"headline":"Backup a Dell 2824 Switch from Command Line","datePublished":"2015-01-22T21:57:17+00:00","dateModified":"2015-01-22T22:00:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/"},"wordCount":419,"commentCount":0,"publisher":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600"},"keywords":["centos","scripting","sysadmin"],"articleSection":["SysAdmin","Teknocratica"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/","url":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/","name":"Backup a Dell 2824 Switch from Command Line - softwareab","isPartOf":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#website"},"datePublished":"2015-01-22T21:57:17+00:00","dateModified":"2015-01-22T22:00:46+00:00","breadcrumb":{"@id":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.softwareab.net\/wordpress\/backup-dell-2824-switch-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.softwareab.net\/wordpress\/"},{"@type":"ListItem","position":2,"name":"centos","item":"https:\/\/www.softwareab.net\/wordpress\/tag\/centos\/"},{"@type":"ListItem","position":3,"name":"Backup a Dell 2824 Switch from Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.softwareab.net\/wordpress\/#website","url":"https:\/\/www.softwareab.net\/wordpress\/","name":"softwareab","description":"Technocratica, Technopolitik, Technophobia","publisher":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.softwareab.net\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600","name":"Andrew Bruce","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg","contentUrl":"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg","width":400,"height":330,"caption":"Andrew Bruce"},"logo":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/"},"description":"Team-oriented systems mentor with deep knowledge of numerous software methodologies, technologies, languages, and operating systems. Excited about turning emerging technology into working production-ready systems. Focused on moving software teams to a higher level of world-class application development. Specialties:Software analysis and development...Product management through the entire lifecycle...Discrete product integration specialist!","sameAs":["http:\/\/cloudraticsolutions.net\/","https:\/\/www.facebook.com\/cloudraticsolutions\/","https:\/\/twitter.com\/realcloudratics"]}]}},"_links":{"self":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts\/927"}],"collection":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/comments?post=927"}],"version-history":[{"count":2,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts\/927\/revisions"}],"predecessor-version":[{"id":930,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts\/927\/revisions\/930"}],"wp:attachment":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/media?parent=927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/categories?post=927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/tags?post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}