{"id":324,"date":"2009-11-02T04:35:46","date_gmt":"2009-11-02T09:35:46","guid":{"rendered":"http:\/\/yourlinuxguy.com\/?p=324"},"modified":"2009-11-02T15:02:09","modified_gmt":"2009-11-02T20:02:09","slug":"handy-little-zypper-up-script","status":"publish","type":"post","link":"https:\/\/yourLinuxGuy.com\/?p=324","title":{"rendered":"Handy little &#8220;zypper up&#8221; script"},"content":{"rendered":"<p>I run quite a few Opensuse (mostly 11.1 at the time of this writing) servers in what you might call &#8220;pseudo-production&#8221; mode.\u00a0 For some of those servers, and especially for my test lab servers, I like to have them as up-to-date as possible by using some type of call to <code>zypper<\/code> in a <code>cron<\/code> job (either direct, or scripted).<\/p>\n<p>And, even though I have the utmost confidence in the creators and maintainers of Opensuse, I still like to keep track of the packages that get updated, just in case some individual packages need to be reverted back to the original versions.\u00a0 And of course, just running <code>zipper up<\/code> alone will not give you any tracking of those changes.<\/p>\n<p>So, I wrote a handy-dandy little script (link below) that will run a comparison against what is <em>about-to-be<\/em>-updated and what-<em>currently<\/em>-exists.\u00a0 The output of the script can be handled in various ways: either direct out to <code>STDERR<\/code> if running it interactively; output to a file; or if it is in a <code>cron<\/code> job, emailed out to the root user.<\/p>\n<p>If there are no packages to update, you get a result that looks like this:<\/p>\n<p style=\"padding-left: 30px;\"><code>Number of patches found: 0<br \/>\nNo updates this time, exiting!<\/code><\/p>\n<p>If there are one or more packages to update, the output looks like this example:<\/p>\n<p style=\"padding-left: 30px;\"><code>Number of patches found: 2<br \/>\nComparing existing packages and updates...<\/code><\/p>\n<p style=\"padding-left: 30px;\"><code>Existing version: package libx264-78 is not installed<br \/>\nUpdating version: libx264-78-0.0svn20091023-0.pm.1.1<br \/>\n<\/code><\/p>\n<p style=\"padding-left: 30px;\"><code>Existing version: MPlayer-1.0rc2_r29116-2.pm.29.8<br \/>\nUpdating version: MPlayer-1.0rc2_r29796-2.pm.2.1<br \/>\n<\/code><\/p>\n<p>&#8230;and so on.\u00a0 The above two packages were updated on my laptop on the day of this writing.<\/p>\n<p>The script itself can be found at the link below:<\/p>\n<p><a title=\"\/wp-content\/uploads\/zCheck-0.2.sh\" href=\"\/wp-content\/uploads\/zCheck-0.2.sh\" target=\"_blank\">zCheck-0.2.sh<\/a><\/p>\n<p>&#8230;and I will update it as I make changes and improve the version, or change for the behavior of <code>zypper<\/code>, etc&#8230;<\/p>\n<p>Okay, time for a few caveats:\u00a0 Believe me, I know it can be better, but &#8220;better&#8221; was not my purpose here.\u00a0 I just wanted a tracking history, and I tossed this together, and am posting it for you here *at your own risk*.\u00a0 And I left the stuff in there to convert the output to a log file, so you can just un-comment it if you want.\u00a0 If you have other errors like DNS failures and such, the script may not respond in a timely fashion.\u00a0 Hmm&#8230;\u00a0 I probably should have written it in Perl too, and dumped the values to an array instead of running <code>zypper<\/code> twice, but there you go.\u00a0 Quick, dirty and effective.\u00a0 Also, please note that the script only works with the versions of <code>zypper<\/code> that includes the XML capability; I know that this does <em>NOT<\/em> include SLES10, but I&#8217;m not sure about others.<\/p>\n<p>If you have any better tweaks to it, make sure to post them, and I&#8217;ll update it as we go along&#8230;<\/p>\n<p>Thanks, and I hope it helps!<\/p>\n<p>\ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I run quite a few Opensuse (mostly 11.1 at the time of this writing) servers in what you might call &#8220;pseudo-production&#8221; mode.\u00a0 For some of those servers, and especially for my test lab servers, I like to have them as&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/yourLinuxGuy.com\/?p=324\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11,58,42],"tags":[],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry","category-intermediate","category-opensuse111","category-zypper"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pnjn1-5e","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324"}],"version-history":[{"count":8,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/324\/revisions"}],"predecessor-version":[{"id":332,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/324\/revisions\/332"}],"wp:attachment":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}