Pop-Up Notification when time reaches 4:00PM?

21

7

I was wondering if there was a way to display a notification or something from the command line at a certain time. Like when the clock strikes 4:00pm. It would be nice if it would display it using Ubuntu's notify-osd tool:

enter image description here

Kredns

Posted 2009-09-09T19:56:38.363

Reputation: 2 857

This is great. I was just asking about something like this at https://askubuntu.com/questions/936645/how-to-make-my-ubuntu-16-04-system-pop-up-a-one-time-to-do-reminder

– SDsolar – 2017-07-16T10:52:50.347

Here I am up still at 3:55am. I suppose I should have had this tell me to go to bed at 3. ;-) btw, can you believe you posted this 7 years and 10 months ago? Hello from the Future; July 2017. – SDsolar – 2017-07-16T10:55:15.883

Do you need to know the exact second you are done with work for the day? – Troggy – 2009-09-09T20:04:27.913

2No. Who gets off at 4:00? I actually need to tell myself to goto bed. – Kredns – 2009-09-09T20:09:44.970

@Lucas Aardvark : LOL. – caliban – 2009-09-09T20:20:16.133

I get off work at 4:00pm.. then again, I get in to work at 7am most days.. – jamuraa – 2009-09-09T21:52:59.097

Answers

35

As many of the other commenters said, the best way to do this on a daily basis is to use cron, but if you are only wanting to do it for one day, or sporadically, you can use the at command:

echo 'notify-send "Work day is done!"' | at 4:00PM 

You can use at in a variety of ways, including as a tea timer:

echo 'notify-send "Get your tea!"' | at now + 3 minutes 
echo 'notify-send "Meeting in 1 hour with the big boss!"' | at 1pm tomorrow 

It's quite useful for those one-off commands.

Check the at manpage for more syntax goodness.

jamuraa

Posted 2009-09-09T19:56:38.363

Reputation: 3 546

You need add DISPLAY variable to environment to work with at or cron. Type this: echo 'export DISPLAY=:0; notify-send "Enjoy!"' | at 04:00 PM. – user3439968 – 2019-04-26T22:52:20.983

You need to apt install libnotify-bin to use notify-send.

– patryk.beza – 2019-08-20T15:56:30.817

You can't type the command on the after the invocation of "at." You have to do something like

echo 'notify-send "Work day is done!"' | at 4:00PM – Ryan C. Thompson – 2009-09-09T23:06:39.323

True, I forgot about that little annoyance. – jamuraa – 2009-09-10T01:04:58.563

I liked your solution best because it can be easily changed and doesn't require root access to edit /etc/crontab – Kredns – 2009-09-10T17:08:19.310

14

Use notify-send to send the notification. Set it up as a cron job.

user4358

Posted 2009-09-09T19:56:38.363

Reputation:

3But that doesn't work out of box. notify-send requires some env variables whichr are not available from cron by defaualt? – Kunok – 2018-03-11T00:33:01.950

11

You can send commands to notify-osd like so:

notify-send "Go to bed!"

A crontab for daily notification at 4pm would look like so:

0 16 * * * /home/username/notify.sh

John T

Posted 2009-09-09T19:56:38.363

Reputation: 149 037

You might need to set DBUS_SESSION_BUS_ADDRESS environment variable before running notify-send. See https://askubuntu.com/a/346580

– Andrej Herich – 2018-09-14T11:07:44.033

0

if you use a program like anacron (warns you even if the computer is not running so useful more than cron for desktops and notebooks etc ) um then i use Zenity its a notification program here is my site for it with a few examples http://sites.google.com/site/venvirupa/yadandyin

stephen P

Posted 2009-09-09T19:56:38.363

Reputation: 1

1Welcome to Super User. External links can break or be unavailable. Please include the essential information within your answer and use the link for attribution and further reading. Thanks. – fixer1234 – 2016-12-06T04:23:00.307

0

You can always set up a cron job to run a script @ 0400hrs. The tricky thing here, is to find out what command to use to popup a window (ala net send for windows), or to do anything to notify you to go off to bed.

notify-osd doesn't seem to support command-line prompt generation, you might want to try LinPopup2...

caliban

Posted 2009-09-09T19:56:38.363

Reputation: 18 979

-1

Looks like you are using gnome-do. There are a few plugins there that can be used - remember the milk (RTM) is one.

Abhinav

Posted 2009-09-09T19:56:38.363

Reputation: 2 030