4

I need to set myself a reminder to attend a weekly meeting. The trouble with my company's standard reminder tool is that when it runs under wine, it pops up on an off-screen virtual desktop.

I thought it would be interesting to see if I could come up with an "at" command that pops up a reminder window and then resubmits itself for the following week.

I know I could use cron or some alarm-clock app but this piqued my curiosity.

The single-shot version would be:

echo "DISPLAY=$DISPLAY zenity --title='Weekly Meeting' --text='Time for the weekly meeting' --info" | at 0955 NEXT Monday

Can someone come up with a suitable quine-like command that, each time it is run, it will additionally resubmit the same command the following week in a repeating cycle?

Veedrac
  • 58,273
  • 15
  • 112
  • 169
Adrian Pronk
  • 13,486
  • 7
  • 36
  • 60
  • @Veedrac, there's *lots* of point to tags like "fun" -- exclusion filters. If such things are tagged, folks who don't want to see things with no practical value can, well, not see them. – Charles Duffy Sep 25 '14 at 23:17
  • @CharlesDuffy Is there a Meta post about this? I was under the impression that meta-tags are unwanted. Eg.http://blog.stackoverflow.com/2010/08/the-death-of-meta-tags/ – Veedrac Sep 25 '14 at 23:19
  • Could well be; I'd have to look. Speaking as someone who has rather a lot of metatags on their "ignore" list, I'm disappointed at their death. – Charles Duffy Sep 25 '14 at 23:20
  • @Veedrac: The reason I (re-)added the `fun` tag is that I refer to it in one of my old comments below. Seemingly it used to be there but was removed. The point was, I didn't want to know how to set myself a weekly, repeating reminder, but, just for "fun", how to do so with a quine-like `at`-command – Adrian Pronk Sep 26 '14 at 05:24
  • @AdrianPronk I don't think you making a comment about the tag is a very compelling reason, especially as meta-tags like this are explicitly disallowed. – Veedrac Sep 26 '14 at 05:32

4 Answers4

1

Give this a try:

export reminder='"DISPLAY=$DISPLAY zenity --title='\''Weekly Meeting'\'' --text='\''Time for the weekly meeting'\'' --info" | at 0955 NEXT Monday'; echo $reminder | at 0955 NEXT Monday

Change both at commands to say at now + 1 minute for testing. $DISPLAY will be set when the command is entered and may not be correct at the time the job executes, but this is the same behavior as the command in your question.

Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
0

Try with a file:

$ cat /tmp/quine_file
DISPLAY=:0.0 zenity --title='Weekly Meeting' --text='Time for the weekly meeting' --info;
at '0955 NEXT monday' </tmp/quine_file;

$ at '0955 NEXT monday' </tmp/quine_file

This way, every time the job is run, another one is scheduled for next monday.

marco
  • 4,455
  • 1
  • 23
  • 20
0

I'm probably cheating, but you can take advantage of the fact that at conserves the value of most environment variables (not $DISPLAY though, neither $DISP it seems):

export FOO=$DISPLAY CMD='DISPLAY=$FOO xmessage "hi there";
echo "$CMD" | at now + 1 minutes'
eval "$CMD"

I used xmessage and one minute because I had them, but of course you can tailor it to your needs.

Jérémie Koenig
  • 1,198
  • 6
  • 11
0

Sorry to spoil the fun, but... wouldn't some sort of cron job make more sense?

SamB
  • 9,039
  • 5
  • 49
  • 56
  • -1: Did you see the "fun" tag? I know how to use a cron job so I don't need to ask on SO about that. What I don't know is how to make a quine-like shell script. Hence this question. – Adrian Pronk Apr 11 '10 at 21:21