[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using crontab to update Debian

Paulo Henrique Baptista de Oliveira wrote:
>     I know that apt-get -d dist-upgrade ask yes, but how do I pipe to
> it. I tried apt-get -d dist-upgrade |  y and doesnt work: y -> command
> not found
>     Thanks,        Paulo Henrique
> > Pipe yes to it.

I think by "Pipe yes to it", he meant to use the "yes" program,
which just prints "y\n" over & over & over ....

Like this:

  yes | apt-get -d dist-upgrade

Of course, this will only work if all of the questions apt-get asks
require the answer "y".  But this may not be the case, since,
according to Shaleh:

> Yes, except for the fact that the install needs you there to hit enter 
> a few times.  Apt says "is this correct [Y/n]", "press enter to 
> continue".  The packages scripts may ask you for info as well.

The "press enter to continue" will probably be ok, yes would just
be typing "y" before pressing enter.  Shouldn't do any harm.

But, you then will be answering "y" to all of the questions asked
by the upgrading scripts.  This is probably not what you want.

Here is a (possibly stupid) idea.  Use the command-line option to
apt-get (I forgot what it was!  Type apt-get --help) that doesn't 
actually download or install anything, just tells you want it *would*
do.  Note the packages that you need.  Then, write a script that
ftp's (using ftp's -s option) all of the required packages at night 
during the cheap download time.  The following day, you can install the 
packages when you are off-line.

Here is another, much simpler, and probably better, idea.  Stay up late 
one night and start "apt-get dist-upgrade" yourself, and once 
downloading starts, go to sleep.  Use cron or at to automatically hang 
up the phone when the expensive rates begin again.  (i.e., just
put "poff" in the script that runs at 6am, or whenever.)

If you got all the packages in one night, you'll wake up to a 
system asking you the first configuration question.

If you hung up in the middle of a download, you can repeat the
procedure again the next night.  apt-get will resume where it was
cut off.

Good luck


Reply to: