Results 1 to 9 of 9

Thread: How to get the outdated pakage list (apt-get upgrade list)

  1. #1
    Join Date
    Aug 2005
    Beans
    115

    How to get the outdated pakage list (apt-get upgrade list)

    Hi, here is a simple question, how can I get a list of package that need to be upgraded. I want to use it in a cron script so It have to just list package, not interact with a shell.

    Thanks!

  2. #2
    Join Date
    Jul 2008
    Location
    Netherlands
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Quote Originally Posted by Elv13 View Post
    Hi, here is a simple question, how can I get a list of package that need to be upgraded. I want to use it in a cron script so It have to just list package, not interact with a shell.

    Thanks!
    Do you want to do automatic updates every night ?
    There's the package called cron-apt amongst others (I've used it for a while), but maybe you want : apticron

  3. #3
    Join Date
    Aug 2005
    Beans
    115

    Re: How to get the outdated pakage list (apt-get upgrade list)

    No, I want to do it myself, it is why I need a packages list. Diong an automiatic update is not hard at all, it look like

    apt-get update
    apt-get upgrade --force-yes

    but I want to use a for loop like

    apt-get update
    for i in (the command)
    my script
    done

  4. #4
    Join Date
    Jul 2008
    Location
    Netherlands
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Quote Originally Posted by Elv13 View Post
    but I want to use a for loop like

    apt-get update
    for i in (the command)
    my script
    done
    If you use the command "sudo apt-get -d dist-upgrade" you can see which packages are marked to be upgraded, and perhaps you can grab that information to run your script.

  5. #5
    Join Date
    Aug 2005
    Beans
    115

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Yes, but it still ask the [Y/N] question, I need to disable it if I want to get the packae list, thats my problem here.

  6. #6
    Join Date
    Jul 2008
    Location
    Netherlands
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Quote Originally Posted by Elv13 View Post
    Yes, but it still ask the [Y/N] question, I need to disable it if I want to get the packae list, thats my problem here.
    Okay, but if you run one script which nightly does :
    sudo apt-get -d dist-upgrade > /tmp/output.txt
    then you can work in another script while extracting the text in /tmp/output.txt and use both in a cronjob.
    Think of tools like awk and sed.
    Perhaps this idea is too difficult to achieve, but it's an idea.

  7. #7
    Join Date
    Aug 2005
    Beans
    115

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Not dificult, just not practicable, it is a hack and is really cheap, this is for production, so even having to deal with the header and end of page feel cheap for a production script. I am sure there is a way somehow. After all how many apps have that list, I don't think they parsed apt-get.

  8. #8
    Join Date
    Jan 2007
    Location
    ~/SC/USA
    Beans
    1,969
    Distro
    Ubuntu

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Install:
    Code:
    sudo apt-get install apt-show-versions
    Then run:
    Code:
    $ apt-show-versions -u
    login/intrepid-security upgradeable from 1:4.1.1-1ubuntu1.1 to 1:4.1.1-1ubuntu1.2
    passwd/intrepid-security upgradeable from 1:4.1.1-1ubuntu1.1 to 1:4.1.1-1ubuntu1.2
    Shows what packages in your system may be updated. The -u option displays a list of upgradeable packages.

  9. #9
    Join Date
    Aug 2005
    Beans
    115

    Re: How to get the outdated pakage list (apt-get upgrade list)

    Thanks! It work perfectly

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •