I need some help with the 'at' command

Hi,

I have only dial-up and I want my computer to do a download for me while I am away. I have found that the command 'at' can help me with this, but I have some questions about its usage.

Here is one way I think I could use it:

Quote:
vs@SargeBox:~$ at now + 3 hours # arbitrary time to begin queued commands
warning: commands will be executed using /bin/sh
at> pon provider #this connect me to my ISP
at> wget http://www.archive.org/download/dn2006-0823/dn2006-0823-1_64kb.mp3 #fetches the example file I want
at> poff # disconnects
at>
job 17 at Thu Aug 24 13:26:00 2006
vs@SargeBox:~$

Another way of doing this would be:

Quote:
vs@SargeBox:~$ at now + 3 hours
warning: commands will be executed using /bin/sh
at> pon provider && wget http://www.archive.org/download/dn2006-0823/dn2006-0823-1_64kb.mp3 && poff
at>
job 18 at Thu Aug 24 13:29:00 2006
vs@SargeBox:~$

I tried both of these and in both case the first command ('pon provider') works and connects me but the download does not seem to begin.

My questions are:

1) how can I monitor in real time what part of the at command is being executed? In other words, is there a way I could make at show me the normal progress dialog of wget?

2) am I doing something wrong? is there a difference between the two methods I tried?

Many thanks,

VS

0

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

use dial-on-demand

runing any more than 1 program gets a bit tricky - the behavior depends on what shell is used etc etc. Instead of doing what you have above, you can:

1. set your machine to use "dial-on-demand"; 'pppconfig' can help you with that or you can edit the control files yourself; read the pppd documentation
2. set a reasonable timeout - 60s is usually good enough if you just want 'wget' to magically connect to the internet.
3. just run the wget command via 'at' rather than attempt to run multiple commands at once

With your first example above, you'll probably find that 'at' will run each of those simultaneously rather than waiting for one to exit before running the next. In your second example I would have thought it should execute sequentially, but you will need to:
a. read the bash manual (only 80+ pages)
b. figure out exactly how 'at' invoked bash (because this can affect its behavior)

Also... read the wget manual again if you want only a file "blah.mp3" - the behavior as you typed above will be to create an entire directory hierarchy for that single file.

run script with 'at'

another option is to get 'at' to run a little bash script. that way you can do more tricky things like add a wait/delay while the modem dials and connects before executing wget etc.

Of course this means you have to read up on shell scripting, it's not hard tho :-)

Are we just a blip in history, where the working class had too much access to information and freedom?

Syndicate content