Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #1328
| From | General Schvantzkoph <schvantzkoph@yahoo.com> |
|---|---|
| Newsgroups | comp.os.linux.misc |
| Subject | Re: at syntax |
| Date | 2011-06-03 13:21 +0000 |
| Message-ID | <94s5emF7lqU4@mid.individual.net> (permalink) |
| References | (3 earlier) <1h8fb8xbmc.ln2@news.roaima.co.uk> <94krmhF7lqU2@mid.individual.net> <mt6lb8xomr.ln2@news.roaima.co.uk> <tlblb8x953.ln2@perseus.wenlock-data.co.uk> <6timb8xpte.ln2@news.roaima.co.uk> |
On Fri, 03 Jun 2011 09:34:14 +0100, Chris Davies wrote: > Dave Gibson <dave.gma+news002@googlemail.com.invalid> wrote: >> $ date >> Thu Jun 2 22:13:12 BST 2011 >> $ echo "echo hello" | at 11:30pm thursday job 638 at Thu Jun 9 >> 23:30:00 2011 > > Thank you for the counter example. And I presume that because (when you > ran this) it was Thursday, and the time was in the future, you expected > "at" to schedule it for that same day. Personally, I don't think I'd > expect that (think about the semantics of English: "can you book me into > a hotel on Friday, please" implies *next* Friday rather than today). > However, I believe I now see what the OP is getting at. > > So, some suggestions for the OP: > > * Use a construct like this one (below) to determine what "today's" DoW > (Day of week) is: > TODAY=$(date +%A | tr '[:upper:]' '[:lower:]') > > * Remove the DoW specification for "at" entirely for the current date > test "$TODAY" = "$DOW" && DOW= > > * Replace the DoW specification to "at" with "today" as appropriate > test "$TODAY" = "$DOW" && DOW='today' > > * Avoid using DoW at all and use absolute dates > > Chris Absolute dates don't work, it's for general purpose scripts which are going to be used for a long time. The person that I've written the scripts for wants to be able to schedule the capture of a TV show on a demand basis, which means that she might run the script on the same day as the show as well as running it in advance. Apparently at has no way of distinguishing between THIS MONDAY and NEXT MONDAY. I've written a wrapper for at called schedule_event which fixes the problem #!/bin/csh -f set path=(/usr/local/bin /usr/local/sbin /usr/bin /sbin /usr/sbin /bin / usr/X11R6/bin /usr/local/csh) if(`date +%a` == $3) then echo at $1 $2 TODAY < /usr/local/csh/$4.csh at $1 $2 TODAY < /usr/local/csh/$4.csh else echo at $1 $2 $3 < /usr/local/csh/$4.csh at $1 $2 $3 < /usr/local/csh/$4.csh endif The line in the script that does the scheduling then looks like schedule_event 8:00 PM Thu big_bang
Back to comp.os.linux.misc | Previous | Next — Previous in thread | Next in thread | Find similar
at syntax General Schvantzkoph <schvantzkoph@yahoo.com> - 2011-05-30 18:08 +0000
Re: at syntax Lew Pitcher <lpitcher@teksavvy.com> - 2011-05-30 16:04 -0400
Re: at syntax General Schvantzkoph <schvantzkoph@yahoo.com> - 2011-05-30 23:16 +0000
Re: at syntax Chris Davies <chris-usenet@roaima.co.uk> - 2011-05-31 09:44 +0100
Re: at syntax General Schvantzkoph <schvantzkoph@yahoo.com> - 2011-05-31 12:37 +0000
Re: at syntax Chris Davies <chris-usenet@roaima.co.uk> - 2011-05-31 14:54 +0100
Re: at syntax General Schvantzkoph <schvantzkoph@yahoo.com> - 2011-05-31 18:52 +0000
Re: at syntax Chris Davies <chris-usenet@roaima.co.uk> - 2011-06-02 21:03 +0100
Re: at syntax dave.gma+news002@googlemail.com.invalid (Dave Gibson) - 2011-06-02 22:24 +0100
Re: at syntax Chris Davies <chris-usenet@roaima.co.uk> - 2011-06-03 09:34 +0100
Re: at syntax General Schvantzkoph <schvantzkoph@yahoo.com> - 2011-06-03 13:21 +0000
Re: at syntax Chris Davies <chris-usenet@roaima.co.uk> - 2011-06-03 15:46 +0100
Re: at syntax Kevin Snodgrass <kdsnodgrass@yahoo.com> - 2011-06-01 02:08 +0000
Re: at syntax General Schvantzkoph <schvantzkoph@yahoo.com> - 2011-06-01 02:50 +0000
Re: at syntax Kevin Snodgrass <kdsnodgrass@yahoo.com> - 2011-06-01 04:30 +0000
Re: at syntax Kevin Snodgrass <kdsnodgrass@yahoo.com> - 2011-06-01 04:31 +0000
Re: at syntax Kevin Snodgrass <kdsnodgrass@yahoo.com> - 2011-06-01 04:31 +0000
Re: at syntax Kevin Snodgrass <kdsnodgrass@yahoo.com> - 2011-06-01 04:30 +0000
csiph-web