On Wed, 28 Sep 2005 12:12, Paweł Madej wrote:
> Dunc wrote:
> > For something you should only do once a day, 10 minutes isn't that bad
> > though.
>
> I sync not day by day but 2-3 times a week but when I sync I want to run
> just after it emerge of updates (I follow new ebuilds on [1] site and
> run emerge if sth interesting for me  appears there).
>
> My other question is if there is some script which could follow rrs from
> [1] and run emerge sync and emerge -uND world after there is for example
> 10 ebuild updated comparing to my system, or other way that it will
> email me that there is 10 ebuilds new and i should run sync manually.
>
> Greets
> Paweł
I second esync. It is a nice script that runs a little faster than 'emerge 
sync'. I have a little script in my daily cron list that follows...

#! /bin/sh
# /etc/cron.daily/esync.automated
# ============================================================================
# Based on rkhunter script by Aaron Walker <[EMAIL PROTECTED]>
# Written by Glenn Enright on 14-Oct-2004
#
# Purpose
#  To provide a facility to regularly update the portage tree via cron so we
#  don't have to remember to do it manually, and send us a list of updates to
#  consider.
#
# Requires
#  portage to be properly installed. see 'man emerge' for details
#  esearch: do 'emerge esearch'
#
# CHANGELOG:
#  19-Oct-2004 - updated to use tool esearch. Improved speed and
#              feedback.
#  29-Sep-2005 - Reviewed code and did some tidying up. Changed file 
#              group to wheel to allow easier administration.
#

# ----------------------------------------------------------------------------
#     ENABLEMENT OPTIONS

# set to no if you don't want to run this script
#
ENABLE=yes

# set to 'yes' if you wish the output to be mailed to you
#
SEND_EMAIL=yes

# ----------------------------------------------------------------------------
#     OPERATIONAL COMMANDS

# main command
#       fixme: is nice needed with 2.6 kernel?
CMD="nice esync --nocolor --nospinner"

# NOTE: the rest of these options are only relevant
# if you set SEND_EMAIL to 'yes'
#
EMAIL_SUBJECT="${HOSTNAME}: 'esync' output"
EMAIL_RECIPIENT=root
EMAIL_CMD="| mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}"

# ============================================================================

if [ "${ENABLE}" = "yes" ]; then

   if [ -x /usr/bin/emerge ]; then
      #-------------------------------------------------------
      # test to see if we want to send success/failure email
      #
      if [ "${SEND_EMAIL}" = "yes" ]; then
         CMD="${CMD} ${EMAIL_CMD}"
      else
         CMD="${CMD} &>/dev/null"
      fi
      # ------------------------------------------------------


      # ------------------------------------------------------
      # check to see if emerge is already running so
      # we dont interupt it. fail gracefully if it is
      #
      if [ ! "ps -ax | grep -c emerge" ]; then
         # NB: the following text is formated from the margin.
         MAIL_WARN_MESSAGE="echo -e ' ** WARNING ** : The program 'emerge' is 
currently running. Please wait for the next scheduled update or run esync 
manually.'"
         eval exec "${MAIL_WARN_MESSAGE} ${EMAIL_CMD}"
      else
         # actually do the thing
         eval exec "${CMD}"
      fi
      # -----------------------------------------------------

   fi
fi
# EOF

-- 

        The programmers of old were mysterious and profound.  We cannot fathom
their thoughts, so all we do is describe their appearance.
        Aware, like a fox crossing the water.  Alert, like a general on the
battlefield.  Kind, like a hostess greeting her guests. Simple, like uncarved
blocks of wood.  Opaque, like black pools in darkened caves.
        Who can tell the secrets of their hearts and minds?
        The answer exists only in the Tao.
                -- Geoffrey James, "The Tao of Programming"

-- 
gentoo-user@gentoo.org mailing list

Reply via email to