Re: yum and automatic updates

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

 



On Mon, Jun 28, 2004 at 05:19:56PM +0200, Ian Hilliard wrote:
> > From: <jix@xxxxxxxxxxxx>
> >
> > I just need to know if yum can update automatically allwithout manual
> > intervention.
> >
> > I would to have a cron job with a "yum update" like, who said "yes" when
> > yum ask "Is this ok [y/N]:"
> >
> > Thx for your response and really sorry for my poor english
> >
> > jix
> 
> Try: "yum -y update"
> 
> The -y indicates to automatically say 'yes'.

On FC2 there is a cron job controlled by 'chkconfig'.

    $ chkconfig --list | grep yum
    yum             0:off   1:off   2:off   3:off   4:off   5:on   6:off

You can turn it on:

    chkconfig yum on

 or off

    chkconfig yum off

The cron file uses the -y flag and looks like this:

    $ cat /etc/cron.daily/yum.cron

    #!/bin/sh

    if [ -f /var/lock/subsys/yum ]; then
	    /usr/bin/yum -R 10 -e 0 -d 0 -y update yum
	    /usr/bin/yum -R 120 -e 0 -d 0 -y update
    fi


I sort of like the idea of adding a download only flag to the yum.cron
file myself.   Then the download time is suffered by the machine
and I have more visibility of the action.  YMMV.

There is nothing preventing a FC1 user from hand installing this stuff.
The file chkconfig finds looks like:

    $ cat /etc/init.d/yum

    #!/bin/bash
    #
    # yum           This shell script enables the automatic use of YUM
    #
    # Author:       Seth Vidal <skvidal@xxxxxxxxxxxx>
    #
    # chkconfig:    - 50 01
    #
    # description:  Enable daily run of yum, a program updater.
    # processname:  yum
    # config: /etc/yum.conf
    #

    # source function library
    . /etc/rc.d/init.d/functions

    lockfile=/var/lock/subsys/yum

    RETVAL=0

    start() {
	    echo -n $"Enabling nightly yum update: "
	    touch "$lockfile" && success || failure
	    RETVAL=$?
	    echo
    }

    stop() {
	    echo -n $"Disabling nightly yum update: "
	    rm -f "$lockfile" && success || failure
	    RETVAL=$?
	    echo
    }

    restart() {
	    stop
	    start
    }

    case "$1" in
      start)
	    start
	    ;;
      stop)
	    stop
	    ;;
      restart|force-reload)
	    restart
	    ;;
      reload)
	    ;;
      condrestart)
	    [ -f "$lockfile" ] && restart
	    ;;
      status)
	    if [ -f $lockfile ]; then
		    echo $"Nightly yum update is enabled."
		    RETVAL=0
	    else
		    echo $"Nightly yum update is disabled."
		    RETVAL=3
	    fi
	    ;;
      *)
	    echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
	    exit 1
    esac

    exit $RETVAL


Now you have all the parts.


-- 
	T o m  M i t c h e l l 
	/dev/null the ultimate in secure storage.



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux