Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: How to make cron auto update ubuntu

  1. #1
    Join Date
    Dec 2007
    Beans
    104
    Distro
    Ubuntu 12.04 Precise Pangolin

    How to make cron auto update ubuntu

    So i got tired of that annoying update manager and removed it from my system, I dont miss it one bit lol but i would like to set a cron job to automate the update process, How would i go about doing this? I want cron to automatically download and install any available updates.

  2. #2
    Join Date
    Jan 2010
    Location
    Sydney, Australia
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to make cron auto update ubuntu

    Quote Originally Posted by sky5564 View Post
    So i got tired of that annoying update manager and removed it from my system, I dont miss it one bit lol but i would like to set a cron job to automate the update process, How would i go about doing this? I want cron to automatically download and install any available updates.
    You might be interested in cron-apt .it was there on Universe repos .
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

  3. #3
    Join Date
    Dec 2007
    Beans
    104
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to make cron auto update ubuntu

    Quote Originally Posted by codemaniac View Post
    You might be interested in cron-apt .it was there on Universe repos .
    How do i use this cron-apt you speak of?

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,245
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: How to make cron auto update ubuntu

    Quick solution is to edit /etc/crontab (as root with sudo) and add the entry:

    Code:
    0 3 * * * root /usr/bin/apt-get upgrade -q -y >> /var/log/apt/myupdates.log
    This will run the update at 3:00 am each day and append the output to /var/log/apt/myupdates.log.

  5. #5
    Join Date
    Dec 2007
    Beans
    104
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to make cron auto update ubuntu

    Quote Originally Posted by SeijiSensei View Post
    Quick solution is to edit /etc/crontab (as root with sudo) and add the entry:

    Code:
    0 3 * * * root /usr/bin/apt-get upgrade -q -y >> /var/log/apt/myupdates.log
    This will run the update at 3:00 am each day and append the output to /var/log/apt/myupdates.log.
    How can i make it run at 9PM instead?

    Will this also install the updates too or just download them?

  6. #6
    Join Date
    Jan 2010
    Location
    Sydney, Australia
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to make cron auto update ubuntu

    Quote Originally Posted by sky5564 View Post
    How do i use this cron-apt you speak of?
    Hi ,

    cron-apt has been documented in the below link .hope this helps .

    https://help.ubuntu.com/community/AutoWeeklyUpdateHowTo
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

  7. #7
    Join Date
    May 2010
    Location
    uk
    Beans
    9,299
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: How to make cron auto update ubuntu

    Hi

    I would update as well, if you don't use cron-apt.

    Code:
    0 3 * * * root /usr/bin/apt-get update && /usr/bin/apt-get upgrade -q -y >> /var/log/apt/myupdates.log
    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  8. #8
    Join Date
    May 2012
    Location
    Slovenia
    Beans
    Hidden!

    Re: How to make cron auto update ubuntu

    Quote Originally Posted by sky5564 View Post
    How can i make it run at 9PM instead?

    Will this also install the updates too or just download them?
    Code:
    9 0 * * * root /usr/bin/apt-get update && /usr/bin/apt-get upgrade -q -y >> /var/log/apt/myupdates.log
    but i might be wrong

  9. #9
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,245
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: How to make cron auto update ubuntu

    That would make the update run at nine minutes past midnight. The minutes field is first, the hours field second. So to run at 9:00 pm you'd use:

    Code:
    0 21 * * * ...
    I thought the only reason to run "apt-get update" is when you change your repository list. That's why I didn't include it before, though it certainly doesn't do any harm to run it each time.

  10. #10
    Join Date
    May 2010
    Location
    uk
    Beans
    9,299
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: How to make cron auto update ubuntu

    Hi

    I wasn't going to post this but for the record...

    From
    Code:
    man apt-get
    update
    update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in
    /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and
    updated packages is available. An update should always be performed before an upgrade or dist-upgrade. Please be aware that the overall progress meter will
    be incorrect as the size of the package files cannot be known in advance.
    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •