Hello. I am trying to write a script to check for updates to the binary packages by checking the output of pkg_add then sending an e-mail if something is found. My very simple script is this:

#!/bin/ksh

NEWPKGS=`pkg_add -Iusx | grep -v "^quirks\-"`

if [ "$NEWPKGS" != "" ]; then
  # send message to admin...
fi

Does that seem like it should work? Anyone know a better way to check for updates to packages automatically? I tried reading the code of pkg_add to see if there was a better way but I wasn't able to find one. Didn't find anything through searching either.

This is one of those things I'd like to set up in a cron job to run once a day then forget about it until a message pops up in my Inbox so I'd like to get it right the first time. Thanks!

--

John Merriam

Reply via email to