<---- template headericclude ----->
A desktop entry for automating yum update
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    smfinley Guest

    A desktop entry for automating yum update

    First create a sudo user. To do this open a terminal as your regular user. Type "su -". Hit enter. Type your root password. Hit enter. Type "visudo". Hit enter. Hit the "insert" key. With the down arrow key scroll down to the blank line just below the line that reads "root ALL=(ALL) ALL". Type the following: "your_user_name ALL=(ALL) NOPASSWD: ALL". (Of course substitute your user name for "your_user_name" and don't use the quote characters.) Hit the "escape" key. Type ":wq" but don't enter the quote characters. This means "write and quit" in vi, the text editor you are using. Hit enter. (You have just created a sudo user with root privileges and no password required. Note that some consider this a security risk. However I have never had any problems with it.) Hit enter. Type "exit". Hit enter. Type "gedit y.sh". Hit enter. In gedit enter the following:
    Code:
    #!/bin/bash
    sudo yum clean all
    sudo yum -y update
    sudo yum clean all
    echo -e "Finished? Press enter to exit the terminal.\c"
    read 
    exit 0
    Be sure to enter a blank line (carriage return) at the end of the file. Hit the "Save" button in gedit and close gedit. Type "chmod +x y.sh". Hit enter. Type "sudo mv y.sh /usr/bin". Hit enter. Type "sudo gedit /usr/share/applications/yum.desktop". Hit enter. In gedit enter the following:
    Code:
    [Desktop Entry]
    Name=Yum Update
    Comment=Yum Update
    Exec=y.sh
    Icon=/usr/share/icons/Bluecurve/24x24/stock/gtk-add.png
    Terminal=true
    Type=Application
    Categories=Application;Other;
    Be sure to enter a blank line (carriage return) at the end of the file. Hit the "Save" button in gedit and close gedit. Your automated yum update button should now appear in "Applications" > "Other" as "Yum Update".
    Last edited by smfinley; 7th April 2006 at 07:44 PM.

  2. #2
    Join Date
    Jul 2004
    Location
    Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
    Age
    79
    Posts
    24,999
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Sir! Saves me a whole 30 sec's a day with that one.
    Seriously, works like a charm and long overdue. Of course, the first cracker who writes a virus including 'sudo rm /" will be a problem.....
    Last edited by justol'bob; 23rd February 2006 at 03:34 AM.
    Linux & Beer - That TOTALLY Computes!
    Registered Linux User #362651


    Don't use any of my solutions on working computers or near small children.

  3. #3
    Dayguy Guest
    I like to use cron for automatically updating like so...

    /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

    Just another way.

  4. #4
    smfinley Guest
    Quote Originally Posted by justol'bob
    Thank you Sir! Saves me a whole 30 sec's a day with that one.
    Seriously, works like a charm and long overdue. Of course, the first cracker who writes a virus including 'sudo rm /" will be a problem.....
    You're right Bob. There has always been a debate about the wisdom of creating a sudo user with the "NOPASSWD:" option. I fully expect some heated criticism on this one. However I believe there's a fine line between healthy caution and paranoia. As I mentioned, I have personally never had a problem with using sudo this way and it saves me a lot of time for many commands. For the record I always run with SELinux enabled and with a very restrictive firewall.
    Last edited by justol'bob; 23rd February 2006 at 03:34 AM.

  5. #5
    Join Date
    Jul 2004
    Location
    Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
    Age
    79
    Posts
    24,999
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, one quick way to appease everyone might be to simply remove the "NOPASSWORD:" so visudo becomes:
    "username ALL=(ALL) ALL"
    That way, you'd still have to type the password, but that's all.
    Last edited by justol'bob; 23rd February 2006 at 01:58 AM.
    Linux & Beer - That TOTALLY Computes!
    Registered Linux User #362651


    Don't use any of my solutions on working computers or near small children.

  6. #6
    Join Date
    Aug 2005
    Location
    Anaheim/Fullerton, CA (USA)
    Age
    38
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dayguy
    I like to use cron for automatically updating like so...

    /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

    Just another way.
    Alternatively, you can use the nightly cron provided by Yum:
    Code:
    # chkconfig yum on
    # service yum start
    That's what I do. I only update packages manually if it's a security fix or bugfix that I need. Otherwise I generally let it update on its own while I'm deaming of Tuxes. ^_^
    ~~ Peter ~~ :: ( Who am I? ) :: ( My Blog: A day (or more) in the life of a CS & Language student... ) :: ( Supporter of the EFF & FSF ) :: ( I'm a GNU/Linux addict and Free Software Advocate. ) :: ( How to Ask Questions the Smart Way ) :: ( The Fedora Project, sponsored by Red Hat ) :: ( GNOME: The Free Software Desktop Project ) :: ( GnuPG Public Key ) :: ( About me on the WIki )

  7. #7
    crypto76 Guest
    what about limiting what one can execute with sudo...hmmmm

  8. #8
    smfinley Guest
    Edited y.sh in the original post so that the terminal won't disappear before you have a chance to see what yum did.

  9. #9
    Join Date
    Jun 2005
    Location
    Athens-Greece
    Posts
    1,331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mr Stanton Finley excellent work!!!
    Drink more beer but never drive !!!
    :) :p :eek:

  10. #10
    Join Date
    Jul 2005
    Posts
    590
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know this thread is old but if anyone uses this technique the may want to consider creating an entry in your sudo user file like this:
    Code:
    user_name     ALL= NOPASSWD: /usr/bin/yum
    This prevents this user from running any command other than yum using sudo. It also preserves the no password aspect of Stanton's original post.

  11. #11
    jazzjeff Guest
    "yum clean all" - This could potentially be a waste of bandwidth? You should remember that high speed internet is not available for everyone. Those packages in /var/cache/yum/ can also be re-used.

    Also as an admin you should not should run automatic overnight updates, if you have other repos enabled you can trash your system and wake up in the morning to pickup the pieces. It is best to do yum update then say 'y or n'

    Just my 2 cents
    Last edited by jazzjeff; 24th May 2006 at 05:24 PM. Reason: bring point across

  12. #12
    Join Date
    Jul 2004
    Location
    Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
    Age
    79
    Posts
    24,999
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jazzjeff, having a bad day? This is the second thread that I've checked and found negative content. Take a break until your mood changes, please.
    Linux & Beer - That TOTALLY Computes!
    Registered Linux User #362651


    Don't use any of my solutions on working computers or near small children.

  13. #13
    jazzjeff Guest
    Perhaps I put the wording incorrectly

    Quote Originally Posted by www.redhat.com/fedora/
    For some of us, downloading a new version of Fedora and burning it to a CD is simple. But for some people, especially those in developing countries, it can be virtually impossible...
    Having yum run automatically and clean packages twice each day is not advisable for the following reasons :-

    - bandwidth is at a premium
    - the chance to roll back to a previous version if the new update does not work.
    - Admins are advised to run yum update then see changes made.

    Mr Finley gives good advice and has an excellent pages on the web but on this ocassion it would be best to bear in mind the best practices for all.

  14. #14
    smfinley Guest
    If you don't have a high bandwidth connection you can safely remove the "yum clean all" lines from the script. I find that the "yum clean all" command (for me at least with my high bandwidth connection) makes for a cleaner and more reliable update.

  15. #15
    jazzjeff Guest
    What about keeping the old packages in case you need to roll back. In some cases the new kernel/package may mess your system so having a backup is a good idea. There was a guy saying in one of the forums above that he could not get networking to run after updates. In this case he can go back to the working package and have a chance to file a bug report or seek help from the forum.

Page 1 of 2 12 LastLast

Similar Threads

  1. Idea's/Solutions for automating desktop switching
    By Axklor in forum Using Fedora
    Replies: 1
    Last Post: 3rd October 2007, 03:42 AM
  2. Automating account creation?
    By DeCSS in forum Servers & Networking
    Replies: 6
    Last Post: 31st August 2007, 06:45 AM
  3. Help with automating some terminal commands
    By Enigma 2100 in forum Using Fedora
    Replies: 3
    Last Post: 8th December 2006, 08:53 PM
  4. Automating the keyring
    By prdufresne in forum Servers & Networking
    Replies: 16
    Last Post: 6th November 2006, 11:57 PM
  5. Automating tasks
    By cutesneakers in forum Using Fedora
    Replies: 2
    Last Post: 22nd July 2005, 04:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
[[template footer(Guest)]]