JP Vossen on 8 Jan 2011 15:00:04 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux n00b question


On 01/08/2011 12:28 PM, plug-request@lists.phillylinux.org wrote:
Date: Sat, 8 Jan 2011 06:42:52 -0500
>From: Art Alexion  <art.alexion@gmail.com>
>
Ubuntu system upgrades tend to get sloppy over time. Then you will
want to do a clean install. Having a home partition can be handy in
that case. Been using Ubuntu since Warty (3.10?), and some upgrades
have just been more problematic than others.

I haven't noticed that on mine. But I tend to strenuously avoid going outside the package system, use 'aptitude install' and 'aptitude purge' and maybe that helps keep cruft down.


On a small drive netbook, I have occasionally had
/var/cache/apt/archive fill up, but never /var/log. Fixing the former
is as easy as running "sudo aptitude autoclean" from a terminal once
in a while.

Oh that's a good point. I have some cron jobs that take care of that, so I never think about it.

<root crontab -l>
# Update apt and show what needs to be upgraded.  EM results to root.
00 04 * * Wed /opt/bin/show_package_updates

# Make sure NTP is in sync, more or less
25 * * * * ntptrace 2> /dev/null | head -n1 | perl -ne 'm/^[\w.]+: stratum (\d+),/ or next; print qq(NTP not in sync: $_) if ( $1 > 5 );'

# 4 AM every Friday
# Build a list of installed packages (e.g., for recovery purposes)
00 04 * * Fri /usr/bin/dpkg-query --show --showformat='${Status}\t${Package}\t${Version}\n' > /etc/package.list
</root crontab -l>


And...

$ less /opt/bin/show_package_updates
      1 #!/bin/sh -
      2 # get_package_updates--Trivially check for new packages
      3
      4 # $Id: show_package_updates 1675 2010-03-03 19:29:21Z root $
      5 # $URL: file:///home/SVN/usr_local_bin/show_package_updates $
      6
7 echo "$HOSTNAME:" 'running $Id: show_package_updates 1675 2010-03-03 19:29:21Z root $'
      8
9 # Random wait (except on drake) so not everything is updating at once
     10 [ "$HOSTNAME" = 'drake' ] || /opt/bin/waitfor 500
     11
     12 # Display IPAs; useful for remote and/or DHCP machines
13 /sbin/ifconfig | grep -o 'inet addr:.*' | grep -v 'inet addr:127.0.'
     14 echo ''
     15
16 # Clean up the cache, then look for updates, but filter out some noise
     17 /usr/bin/aptitude clean > /dev/null
     18 /usr/bin/aptitude update \
     19   | egrep -v '^Get:|^Hit|^Ign|^Reading|^Building|^Initializing'
     20 echo ''
     21 #/usr/bin/aptitude --simulate full-upgrade
     22 /usr/bin/aptitude --simulate full-upgrade \
23 | egrep -v '^Reading|^Building|^Initializing|^Do you want to continue'


$ less /opt/bin/waitfor
      1 #!/bin/bash -
2 # waitfor--Like sleep except for a random integer period in an arbitrary range
      3
      4 # $Id: waitfor 1590 2009-06-13 21:14:04Z root $
      5
      6 # Usage: $0 max        # Default min = 1
      7 # Usage: $0 min max
      8
      9 if [ "$2" ]; then
     10     min="$1"
     11     max="$2"
     12 else
     13     min='1'
     14     max="$1"
     15 fi
     16
     17 random_delay='-1'
     18 until [ $random_delay -ge $min -a $random_delay -le $max ]; do
     19     random_delay=$RANDOM
     20 done
     21
     22 sleep $random_delay
     23 exit 0


Later,
JP
----------------------------|:::======|-------------------------------
JP Vossen, CISSP            |:::======|      http://bashcookbook.com/
My Account, My Opinions     |=========|      http://www.jpsdomain.org/
----------------------------|=========|-------------------------------
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug