nextday
|
Before my UNIX systems had personal crontabs ( 40.12 ) , I wanted a way to make an at job ( 40.3 ) repeat itself the next weekday (skipping Saturday and Sunday) or, sometimes, every day. Our at was simple-minded and didn't understand dates like now + 1 day . This script with two names, nextday and nextweekday , did the job. I called it from inside my at job, like this: |
---|
`...` |
% |
---|
On Thursday, the result will be a command like
at 2325 Friday atjob
. On Friday, the command will be
at 2325 Monday atjob
; using
nextday
instead, the result would be
at 2325 Saturday atjob
.
The -n option returns a numeric weekday.
NOTE: This script only works with some versions of date . If your version doesn't understand format strings like
+%
format
, install the date ( 51.10 ) from the CD-ROM.
You can install this script from the CD-ROM or from the online archive ( 52.7 ) . If you get it from the archive, ask tar to install nextday and its other link:
%tar xvf
archive.tar
nextday nextweekday
x nextday, 1564 bytes, 4 tape blocks nextweekday linked to nextday
The script tests the name it was called with, in
$0
, to decide which command to run.
-