HP3000-L Archives

April 2002, Week 5

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Emerson <[log in to unmask]>
Reply To:
Tom Emerson <[log in to unmask]>
Date:
Mon, 29 Apr 2002 23:12:35 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (61 lines)
> -----Original Message-----
> From: Tony Gil
>
> I'm currently FTP'ing data from the HP-3000 to a Linux FTP server.
>
> I'm trying to run a script which will act like a "sleeper"
> job to be run on the Linux server. [...]
> If a file is not present, the job goes (back) to sleep for x
> minutes.

Actually, linux/unix already has a "sleeper" like component as part of the
standard -- known under various names such as "at", "cron", and "anacron",
with "cron" being the most prevailent.

Basically, you create a file known as a "crontab" which contains lines of
the form:

<minute> <hour> <day-of-month> <month> <day-of-week> [command]

Each of these "time" segments are separated by one or more space (no commas
or anything like that) and act somewhat like tumblers in a lock: when they
all line up to "the current time", the "command" gets executed [which is
usually the name of a script to invoke]  The asterisk matches as a wildcard,
thus a line like this:

0 * * * * /home/anon/bin/checkftp

means run the "checkftp" script found in the "bin" subdirectory of the
"anon" user every hour ON the hour.

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/anon/bin/checkftp

runs the same command every 5 minutes, but as you can see, that's a lot of
typing -- naturally, there is a shortcut:

*/5 * * * * /home/anon/bin/checkftp

the "/x" means "every 'x'th occurance", or in the example above, every 5
minutes.

for the month and day-of-week, the actual names can be used instead of
numbers, so:

0 0 * * sun /home/anon/bin/purgeoldftp

would run a script to purge any "leftover" files at midnight every sunday.

see the cron, crontab, and "crontab(5)" man pages for details (actually,
each page lists other related man pages to review) -- in cases where a
"segment" number is specifically mentioned, like "crontab(5)", the command
to use is as follows:

  $ man 5 crontab

instead of just

  $ man crontab

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2