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

Re: history of system



On Thu, Apr 21, 2005 at 01:16:36PM -0500, Gary Turner wrote:
> Ron Johnson wrote:
> >
> >Every time after I run apt-get, I run this script AS ROOT:
> >
> >  #!/bin/sh
> >  
> >  x=`date +%y%m%d.%H%M`
> >  COLUMNS=120 dpkg -l > ~/dpkg/dpkg.installed.$x
> >  ln -sf ~/dpkg/dpkg.installed.$x ~/dpkg/dpkg.installed
> >
> >diff'ing files tells me what changed.
> >
> Very similar to the script I use, except that mine auto-diffs.  The 

Here's a version using rcs to maintain previous lists:

  #!/bin/sh
  
  cd ~/.dpkg || exit 1
  
  COLUMNS=140 dpkg -l > .list
  
  # show changes 
  diff list .list
  
  mv -f .list list
  
  if [ ! -e "list,v" ]; then
      rcs -i -U -t-"auto-generated dpkg -l listing by $0" list
  fi
  
  ci -u -m"auto-commit by $0" list 2>&1

This can be run manually or by cron (e.g., hourly).  Nothing will 
be saved to the repository if no changes occurred.

> question is why run it as root?  Am I missing a security issue?  ~gt is 
> my 'admin' user and permissions are 700.

I'd tend to cron and run it (or any script or program) as an ordinary
user unless there's some reason to run as root.

Ken

-- 
Ken Irving, fnkci@uaf.edu
Water and Environmental Research Center
Institute of Northern Engineering
University of Alaska, Fairbanks



Reply to: