96MB Forum
apt-get via cron not working? - Printable Version

+- 96MB Forum (http://96forum.com)
+-- Forum: VPS Discussions (http://96forum.com/forumdisplay.php?fid=32)
+--- Forum: VPS Help (http://96forum.com/forumdisplay.php?fid=35)
+--- Thread: apt-get via cron not working? (/showthread.php?tid=188)



apt-get via cron not working? - zhuanyi - 08-16-2013

I have a very simple apt-get script that has a one line code like:

apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade

And I have set it up via cron to run every evening, using crontab -e:

0 3 * * * /root/apt.sh

However when I ran the script manually after a month or so, I get over 50 package updates, which seems to show that the cron did not work properly.

What I can confirm so far:

1. The script is working when running manually
2. The cron is working since I had other cron jobs running and they all seem to work

I am on Debian 6.

Anyone could help?


RE: apt-get via cron not working? - tmn29a - 08-26-2013

Can't find the problem, but why do you "apt-get -y upgrade && apt-get -y dist-upgrade" ?


RE: apt-get via cron not working? - zhuanyi - 08-26-2013

(08-26-2013, 09:36 PM)tmn29a Wrote: Can't find the problem, but why do you "apt-get -y upgrade && apt-get -y dist-upgrade" ?

Sorry....but why not? Smile

You mean why the -y part of why the upgrade/dist-upgrade part?


RE: apt-get via cron not working? - tmn29a - 08-26-2013

I mean why update and then dist-upgrade ?

From the man pages :

Code:
dist-upgrade
    In addition to performing the function of upgrade, this option also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones, if necessary.

Which means, that dist-upgrade does everything and upgrade is redundant !


RE: apt-get via cron not working? - zhuanyi - 08-26-2013

(08-26-2013, 11:14 PM)tmn29a Wrote: I mean why update and then dist-upgrade ?

From the man pages :

Code:
dist-upgrade
    In addition to performing the function of upgrade, this option also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones, if necessary.

Which means, that dist-upgrade does everything and upgrade is redundant !


Interesting...I was always under the impression they do something different because when I runs upgrade followed by dist-upgrade, I get quite a few packages to upgrade...

Guess now I learnt something new today Smile

But I guess the issue here is apt just does not seem to run via Cron at all. Like nothing was updated even though other cron jobs runs on a daily basis.