Re: Using crontab to update Debian

1999-03-12 Thread Ben Messinger
snip
 Quoting Shaleh ([EMAIL PROTECTED]):
 
  On 09-Mar-99 Paulo Henrique Baptista de Oliveira wrote:
   Hi Debian users,
   In my country (Brazil) I only have to pay one tax between 0:00 and
   6:00 AM independent of call time.
   I'm start thinking to get my home machine live at night and set crontab
   to use pon or wvdial (I have two account, one with pon and other with
   wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
   Am I following the right path to solution?
   The script will be only:
   #!/bin/bash
   apt-get update
   apt-get dist-upgrade
   ?
   Have a nice day,Paulo Henrique
  
  
 
  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.

You can add the -y switch to your apt-get command to automatically
answer yes to all the promts. This would facilitate unattended
updates. Be shure to read your logs though to see what got replaced
durring the night! I set my system up like this. It has worked _almost_
perfectly (having your dot-files replaced without your knowledge can be
anoying). It is nice though to wake up each morning to find that
_everything_ on your system is up to date.

Two examples of problems I encountered are:

1. One day after some updates gnome stopped working. I never use it
anyway so I didn't even try to fix it yet.

2. Another day I went to print a document and couldn't access /dev/lp0.
Apt-get had updated the lpr package durring the night and replaced the
permissions file with a new one that locked me out. Easy to fix, but an
inconvenience.

Good luck.
- Ben Messinger
-- 
If Micro$oft were a pharmacutical company I would hate to think what
they
might do to get us to buy more pain medication.


Re: Using crontab to update Debian

1999-03-11 Thread John Galt

There is a holdover command from Berkely Unix called yes used almost
exclusively in scripting--what it does is continuously applies yes^M (the
^M is a representation of the return key) [wups--apparently it replies
only y now]  while it's active. So what your script line
would be is yes | apt-get -d dist-upgrade,
thus the script can run an interactive program relatively
non-interactively.  The only caveat here is it will ONLY reply yes^M
There is also a command called no for when you wish to reply no to any
input.

On Wed, 10 Mar 1999, Paulo Henrique Baptista de Oliveira wrote:
snip
 
 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.
 
 
 On Tue, 9 Mar 1999, Shaleh wrote:
 
 
  On 09-Mar-99 Paulo Henrique Baptista de Oliveira wrote:
   Hi Debian users,
   In my country (Brazil) I only have to pay one tax between 0:00
 and
   6:00 AM independent of call time.
   I'm start thinking to get my home machine live at night and set
 crontab
   to use pon or wvdial (I have two account, one with pon and other
 with
   wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
   Am I following the right path to solution?
   The script will be only:
   #!/bin/bash
   apt-get update
   apt-get dist-upgrade
   ?
   Have a nice day,Paulo Henrique
  
  
 
  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.
 
  A better solution may be to try and setup a mirror program and just
 grab
  packages you are interested in (X, libc, dpkg, other essentials).
 
 
 
 -- 
 Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED]  /dev/null
 

Pardon me, but you have obviously mistaken me for someone who gives a
damn.
email [EMAIL PROTECTED]


Re: Using crontab to update Debian

1999-03-11 Thread Justin Akehurst
On Wed, 10 Mar 1999, John Galt wrote:

 There is a holdover command from Berkely Unix called yes used almost
 exclusively in scripting--what it does is continuously applies yes^M (the
 ^M is a representation of the return key) [wups--apparently it replies
 only y now]  while it's active. So what your script line
 would be is yes | apt-get -d dist-upgrade,
 thus the script can run an interactive program relatively
 non-interactively.  The only caveat here is it will ONLY reply yes^M
 There is also a command called no for when you wish to reply no to any
 input.

I do believe there is a switch you can feed apt-get called '-y' that
essentially does the same thing.

-Justin Akehurst
[EMAIL PROTECTED]


Re: Using crontab to update Debian

1999-03-11 Thread Ryan Yeske
On Wed, Mar 10, 1999 at 11:43:50PM -0700, John Galt wrote:
 
 There is a holdover command from Berkely Unix called yes used almost
 exclusively in scripting--what it does is continuously applies yes^M (the
 ^M is a representation of the return key) [wups--apparently it replies
 only y now]  while it's active. So what your script line
 would be is yes | apt-get -d dist-upgrade,
 thus the script can run an interactive program relatively
 non-interactively.  The only caveat here is it will ONLY reply yes^M
 There is also a command called no for when you wish to reply no to any
 input.

actually, you can type anything after yes and it will continuously
output that string.  ie:
$ yes no
no
no
no
...

rcy


Re: Using crontab to update Debian

1999-03-11 Thread Kirk Hogenson
I wrote:
 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.)

Paulo Henrique Baptista de Oliveira wrote:
 The problem is that I dont want to stay wake up until 12:00 
 tonight. I like to sleep early

Jason Gunthorpe wrote:

 apt-get -yfqq update
 apt-get -dyfqq dist-upgrade
 
 Is the best way to run it from cron, run it again without the options
 during the day to install it


So, now it seems you have your answer!  Use the crontab script
you had before, adding the options listed by Mr. Gunthorpe.  That
solves the staying up 'till midnight problem.  You can use
another cron job to automatically kill the connection at 6am
(with poff).

You might have to do it again the next night if not everything
was retrieved in one night.

Paulo Henrique Baptista de Oliveira wrote:
 
 Do you know if there is a manner to reconect if the connection 
 goes down and re-run apt-get?

 Better, is there a a possibility to detect if the connection goes 
 down, reconnect and run apt-get again?


I wish I had my Debian system handy so I could be more specific... 
perhaps my comments will spur someone else into giving more details if
anything I'm going to say is unclear/misleading/wrong/stupid.

When you run pon, it creates a file somewhere under /var that contains
the process id of ppp.  IIRC, it is /var/run/ppp.pid

When you run poff, it looks in this file to see which process should be 
killed.  You can probably find the name  location of this file with 
man pon if it isn't /var/run/ppp.pid.  (It might be ppp0.pid)
You could also just look in /var/run when you are connected.

You could write a little script that checks if this file is still
there.  If it isn't, the script could restart the connection and
apt-get, which will be smart enough to pick up where it left off.
You can run this script with cron as well.

A first stab at it could be:

while true;
do
  sleep 1200
  test -f /var/run/ppp.pid || your-apt-get-script
done

This will (or at least, it should!) run your-apt-get-script if
the file /var/run/ppp.pid doesn't exist.

To avoid it reconnecting after 6am, you might add a simple counter
so that it only executes 18 times.  (18 since you want to be connected
for 6 hours, and this sleeps for 20 minutes (1200 seconds) -- if it runs 
18 times, it has run for 6 hours.)

Kirk


RE: Using crontab to update Debian

1999-03-10 Thread Shaleh

On 09-Mar-99 Paulo Henrique Baptista de Oliveira wrote:
 Hi Debian users,
 In my country (Brazil) I only have to pay one tax between 0:00 and
 6:00 AM independent of call time.
 I'm start thinking to get my home machine live at night and set crontab
 to use pon or wvdial (I have two account, one with pon and other with
 wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
 Am I following the right path to solution?
 The script will be only:
 #!/bin/bash
 apt-get update
 apt-get dist-upgrade
 ?
 Have a nice day,Paulo Henrique
 
 

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.

A better solution may be to try and setup a mirror program and just grab
packages you are interested in (X, libc, dpkg, other essentials).


Re: Using crontab to update Debian

1999-03-10 Thread Paulo Henrique Baptista de Oliveira
A mirror is much bandwith for me.
I didnt test yesterday.
I will test tonight when I was at home.
Thank you,  Paulo Henrique
Quoting Shaleh ([EMAIL PROTECTED]):
 
 On 09-Mar-99 Paulo Henrique Baptista de Oliveira wrote:
  Hi Debian users,
  In my country (Brazil) I only have to pay one tax between 0:00 and
  6:00 AM independent of call time.
  I'm start thinking to get my home machine live at night and set crontab
  to use pon or wvdial (I have two account, one with pon and other with
  wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
  Am I following the right path to solution?
  The script will be only:
  #!/bin/bash
  apt-get update
  apt-get dist-upgrade
  ?
  Have a nice day,Paulo Henrique
  
  
 
 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.
 
 A better solution may be to try and setup a mirror program and just grab
 packages you are interested in (X, libc, dpkg, other essentials).


RE: Using crontab to update Debian

1999-03-10 Thread John Galt

Pipe yes to it.


On Tue, 9 Mar 1999, Shaleh wrote:

 
 On 09-Mar-99 Paulo Henrique Baptista de Oliveira wrote:
  Hi Debian users,
  In my country (Brazil) I only have to pay one tax between 0:00 and
  6:00 AM independent of call time.
  I'm start thinking to get my home machine live at night and set crontab
  to use pon or wvdial (I have two account, one with pon and other with
  wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
  Am I following the right path to solution?
  The script will be only:
  #!/bin/bash
  apt-get update
  apt-get dist-upgrade
  ?
  Have a nice day,Paulo Henrique
  
  
 
 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.
 
 A better solution may be to try and setup a mirror program and just grab
 packages you are interested in (X, libc, dpkg, other essentials).
 
 
 -- 
 Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED]  /dev/null
 

Pardon me, but you have obviously mistaken me for someone who gives a
damn.
email [EMAIL PROTECTED]


Re: Using crontab to update Debian

1999-03-10 Thread Paulo Henrique Baptista de Oliveira
I put in /etc/cron.daily the following script:

[18:42:[EMAIL PROTECTED]:~$more /etc/cron.daily/upgrade_debian
#!/bin/sh
#
# Para  atualizar a Debian de madrugada
# update-debian cron daily

pon
sleep 20
apt-get update
apt-get -d dist-upgrade
[18:42:[EMAIL PROTECTED]:~$

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.


On Tue, 9 Mar 1999, Shaleh wrote:


 On 09-Mar-99 Paulo Henrique Baptista de Oliveira wrote:
  Hi Debian users,
  In my country (Brazil) I only have to pay one tax between 0:00
and
  6:00 AM independent of call time.
  I'm start thinking to get my home machine live at night and set
crontab
  to use pon or wvdial (I have two account, one with pon and other
with
  wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
  Am I following the right path to solution?
  The script will be only:
  #!/bin/bash
  apt-get update
  apt-get dist-upgrade
  ?
  Have a nice day,Paulo Henrique
 
 

 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.

 A better solution may be to try and setup a mirror program and just
grab
 packages you are interested in (X, libc, dpkg, other essentials).



Re: Using crontab to update Debian

1999-03-10 Thread Kirk Hogenson
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

Kirk


Re: Using crontab to update Debian

1999-03-10 Thread Jason Gunthorpe

On Wed, 10 Mar 1999, Kirk Hogenson wrote:

 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:

Erm,

apt-get -yfqq update
apt-get -dyfqq dist-upgrade

Is the best way to run it from cron, run it again without the options
during the day to install it

Jason


Re: Using crontab to update Debian

1999-03-10 Thread Paulo Henrique Baptista de Oliveira
Kirk Hogenson wrote:

 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.)


The problem is that I dont want to stay wake up until 12:00 tonight. I
like to sleep early


 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

 Kirk

Do you know if there is a manner to reconect if the connection goes
down and re-run apt-get?
Better, is there a a possibility to detect if the connection goes down,
reconnect and run apt-get again?
Much tanks,Paulo Henrique


Re: Using crontab to update Debian

1999-03-10 Thread Paulo Henrique Baptista de Oliveira
Jason Gunthorpe wrote:

 On Wed, 10 Mar 1999, Kirk Hogenson wrote:

  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:

 Erm,

 apt-get -yfqq update
 apt-get -dyfqq dist-upgrade

 Is the best way to run it from cron, run it again without the options
 during the day to install it

 Jason

If i made the scripts I will submit to you to put in apt. Ok?
Much tanks,Paulo Henrique



Using crontab to update Debian

1999-03-09 Thread Paulo Henrique Baptista de Oliveira
Hi Debian users,
In my country (Brazil) I only have to pay one tax between 0:00 and
6:00 AM independent of call time.
I'm start thinking to get my home machine live at night and set crontab
to use pon or wvdial (I have two account, one with pon and other with
wvdial) and use /etc/ppp/ip-up.d/script_to_upgrade.
Am I following the right path to solution?
The script will be only:
#!/bin/bash
apt-get update
apt-get dist-upgrade
?
Have a nice day,Paulo Henrique