Results 1 to 2 of 2

Thread: Crontab update&&dist-upgrade

  1. #1
    Join Date
    Jul 2011

    Arrow Crontab update&&dist-upgrade

    I have about five Ubuntu machines I used at least once a week. Whenever I SSH into them, I'm usually greeted with the number of updates. Having lingering updates bugs me, so I made a script (attached):

    /usr/bin/sudo apt-get -y update
    /usr/bin/sudo apt-get -y dist-upgrade
    I know a lot of people strongly recommend checking all updates and only applying the desired, but I've just run update and then dist-upgrade for years now with no problems. I'd like to put this into Crontab, but I've read two things regarding this:

    1. Running a "sudo" operation in Crontab might be a problem as far as requiring a password.
    2. Running a "sudo" operation in Crontab is a bad idea.

    Can someone give me some insight? Like I said, whenever I log on I usually just run:

    . ~/.update
    Which is my above script. (In fact, I might even make an alias "upd" now that I think about it). Anyway, insight to why this is bad or a solution to the crontab sudo password problem would be great help. Thanks!
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2011

    Lightbulb Re: Crontab update&&dist-upgrade

    Nevermind, I figured it out:

    sudo crontab -e -u root
    Then I added the line:

    0 0 * * * /usr/bin/sudo apt-get -y update && /usr/bin/sudo apt-get -y dist-upgrade && echo "Updated on $(date)" >> /home/user/.updatelog
    Feel free to let me know if this is still b ad. Thanks.

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