1753776 Members
7051 Online
108799 Solutions
New Discussion юеВ

Re: at job question

 
Allanm
Super Advisor

at job question

Hi Folks,

I want to schedule multiple at jobs for different days -

The job should run at 6pm everyday on wednesday, thursday, friday, sat, sun & mon.
How do I do that in Linux.

Dont want a cron entry since all of my cron is source controlled and I dont want to touch that.

Thanks,
Allan
3 REPLIES 3
Michael Steele_2
Honored Contributor

Re: at job question

HI

I'd put everything into a file and then just read the file every X hours.

at [ [CC]YY]MMDDhhmm [ . ss ] -or-
at 200910010000.00 (* midnight 10/01 *)
at -f job-file

Here's the format to follow for 'at' commands within the file

-t spectime Define the absolute time to start the job.
spectime A date and time in the format:
[ [CC]YY]MMDDhhmm [ . ss ]
where the decimal digit pairs are as follows:
CC The first two digits of the year (19, 20).
YY The second two digits of the year (69-99, 00-68). See WARNINGS.
MM The month of the year (01-12).
DD The day of the month (01-31).
hh The hour of the day (00-23).
mm The minute of the hour (00-59).
ss The second of the minute (00-61).
If both CC and YY are omitted, the default is the current year.
If CC is omitted and YY is in the range 69-99, CC defaults to 19.
Otherwise, CC defaults to 20.
The range for ss provides for two leap seconds. If ss is 60 or 61, and
the resulting time, as affected by the TZ environment variable, does
not refer to a leap second, the time is set to the whole minute following
mm.
If ss is omitted, it defaults to 00.
time [date] Define the base time for starting the job.
time A time specified as one, two, or four digits. One- and two-digit
numbers represent hours; four digits represent hours and minutes.
Alternately, time can be specified as two numbers separated by a
colon (:), a single quote (├в ), the letter h (h), a period (.), or a comma
(,). Spaces may be present between the separator and digits
representing minutes. If defined in langinfo(5), special time unit
characters can be used.
am or pm can be appended to indicate morning or afternoon. Otherwise,
a 24-hour clock is understood. For example, 0815, 8:15,
8├в 15, 8h15, 8.15, and 8,15 are read as 15 minutes after eight in
the morning. The suffixes zulu and utc can be used to specify Coordinated
Universal Time (UTC), equivalent to Greenwich Mean Time
(GMT).
The special names midnight, noon, and now are also recognized.
date A day of the week (fully spelled out or abbreviated) or a date consisting
of a day, a month, and optionally a year. The day and year fields
must be numeric, and the month can be either fully spelled out, abbreviated,
or numeric. The fields in the date string are separated by
punctuation marks such as slash (/), hyphen (-), period (.), and
comma (,). If defined in langinfo(5), special date unit characters can
Section 1-28 - 2 - HP-UX Release 11i: December 2000
a
at(1) at(1)
be present. A field having a value greater than 31 is treated as the
year field and the remaining two fields in the date string are treated
as month and day fields. Otherwise, if a given date is ambiguous (such
as 2/5 or 2/5/10), the D_T_FMT string (if defined in langinfo(5)) is
used to resolve the ambiguity.
Two special days, today and tomorrow, are also recognized. If no
date is given, today is assumed if the given time is greater than the
current time; tomorrow is assumed if it is less.
If the given month is less than the current month (and no year is
given), next year is assumed. Two-digit years in the range 69 to 99
are expanded to 1969 to 1999; in the range 00 to 68, to 2000 to 2068.
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: at job question

HI Again

Here's a better example

at -f $HOME/jobfile -t201312271220.00
Support Fatherhood - Stop Family Law
Dennis Handly
Acclaimed Contributor

Re: at job question

>Don't want a cron entry since all of my cron is source controlled

I would suggest you still use cron, it is meant for what you want to do. Just one entry:
00 18 * * 0,1,3,4,5,6 command

With at(1), you have to keep restarting it. You could include your at(1) command within your script, with a check to ignore Tuesday.