Reputation: 13906
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?
Upvotes: 4
Views: 3236
Reputation: 9224
Sorry to spoil the fun, but... wouldn't some sort of cron job make more sense?
Upvotes: 0
Reputation: 1208
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.
Upvotes: 0
Reputation: 4675
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.
Upvotes: 0
Reputation: 360085
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.
Upvotes: 1