SUMMARY: Proper use of at with -f option

From: Bushman, Gonzo (BUSHMAN@comswsys.tinkernet.af.mil)
Date: Tue Apr 16 1996 - 15:57:00 CDT


Thanks to

Torsten Metzner tom@uni-paderborn.de

He is the only person to answer my question. I am so glad he was able to
help me. He sent me several examples of how to set up what I needed done
and he really came through!

Basically, what my problem was is that I did not have the commands in the
right script files. The examples that I was sent by Mr. Metzner pointed
that right out. What I was doing was scheduling a null job and then calling
the ftp. I am glad to say now that it works the way I wanted.

Hope this helps somebody else out there!

Gonzo Bushman, TSgt, USAF ---- __o
Lead, Systems Administration Team ---- _\<,
WWOLS-R Project ------- (_)`(_)
Tinker AFB, OK USA 73145 -----------------------
Phone: 405-734-3283 Ext. 22
E-Mail: bushman@comswsys.tinkernet.af.mil

 -------------------------My original
post:------------------------------------

>Hello all,
>I have been fighting with a workstation of mine for about a week now trying

>to get the -f option of at to work. It is running 2.4 with patches
>installed. I can get it to accept the commands from a script file, but it
>will start it immediately, not at the scheduled time that I requested (I
>have been testing with the time now + 10 minutes). Basically, my script
>file does an automatic ftp of a certain file from another site for me. The

>problem is that I can't get it to do it when I want. I don't want to set
up
>a cron job because these are one time ftp's, not recurring.
>
>What I am trying to do is to set up a script file that I can pass
parameters
>to telling it the site to ftp to and the time to do it. I have .netrc
files
>set up so it will use the appropriate passwords and all, it just won't do
it
>when I want, it always starts the ftp immediately. Any suggestions? I
hope
>so, you folks have always come through in the past!
>
>Thanks to all, I will naturally summarize, if needed.

 -----------The ONLY response that I received from Mr.
Metzner-------------------
Hello Gonzo,
have a look at the following example. On my machine it works without
a problem.

130: tom@galois[~/tmp]> more muff
#!/bin/sh

ftp ftp.uni-paderborn.de << EOF
cd doc
cd books
cd X-und-Motif
get README
EOF

131: tom@galois[~/tmp]> at -s -f muff now + 2 minutes
warning: commands will be executed using /bin/sh
job 829652280.a at Tue Apr 16 12:58:00 1996
132: tom@galois[~/tmp]> at -l
829652280.a Tue Apr 16 12:58:00 1996
133: tom@galois[~/tmp]> uname -a
SunOS galois 5.4 Generic_101945-32 sun4m sparc

So what are your problems ? Do you have a problem with this example on
your machine or does it works well ?

|What I am trying to do is to set up a script file that I can pass
parameters
|to telling it the site to ftp to and the time to do it.

OK here is a skeleton for your problem.

175: tom@galois[~/tmp]> more muff2
#!/bin/sh

# Here should be some code for testing the arguments
#

# Here it is assumed that $1 == ftp-site, $2 == date in at format

# Solution without a script file

at -s "$2" << EOF
ftp $1 << EOF2
cd doc
cd books
get .dirinfo
EOF2
EOF

# Solution with a script file. E.g. you can generate the script file
# within this script too. You can use $1 in this step

# It's assumed that the file muff exist.

at -s -f ./muff "$2"

176: tom@galois[~/tmp]> ./muff2 ftp.uni-paderborn.de "now +2 minutes"
warning: commands will be executed using /bin/sh
job 829654020.a at Tue Apr 16 13:27:00 1996
warning: commands will be executed using /bin/sh
job 829654021.a at Tue Apr 16 13:27:00 1996
177: tom@galois[~/tmp]> at -l
829654020.a Tue Apr 16 13:27:00 1996
829654021.a Tue Apr 16 13:27:01 1996
178: tom@galois[~/tmp]> ls -al README .dirinfo
README: No such file or directory
.dirinfo: No such file or directory
182: tom@galois[~/tmp]> date
Tue Apr 16 13:30:05 MET DST 1996
183: tom@galois[~/tmp]> at -l
184: tom@galois[~/tmp]> ls -al README .dirinfo
 -rw-r--r-- 1 tom mupas 390 Apr 16 13:27 .dirinfo
 -rw-r--r-- 1 tom mupas 696 Apr 16 13:27 README
185: tom@galois[~/tmp]>

Ah, yes my .netrc file looks like:

186: tom@galois[~]> more .netrc
machine ftp.uni-paderborn.de
login ftp
password tom@uni-paderborn.de
187: tom@galois[~]> ls -al .netrc
 -rw------- 1 tom mupas 69 Apr 16 12:39 .netrc
188: tom@galois[~]>

Hope this helps,

  Torsten.

 ----------------------------------------------------------------------------
 ---
 -
My address : Torsten Metzner E-Mail: tom@uni-paderborn.de
                 MuPAD development group Tel.: +49 5251 602641
                 Universitaet-GH Paderborn Fax : +49 5251 603836
                 FB 17 - Mathematik Office: D3.204
                 Warburger Str. 100
                 33098 Paderborn
                 Germany
 ----------------------------------------------------------------------------
 ---
 -



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:58 CDT