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

15,737

Solution 1

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.

Solution 2

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

Solution 3

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
Share:
15,737

Related videos on Youtube

arxpoetica
Author by

arxpoetica

Bad programming is easy. Idiots can learn it in 21 days, even if they are dummies. --Teach Yourself Programming In Ten Years

Updated on September 17, 2022

Comments

  • arxpoetica
    arxpoetica over 1 year

    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

    • Troggy
      Troggy over 14 years
      Do you need to know the exact second you are done with work for the day?
    • arxpoetica
      arxpoetica over 14 years
      No. Who gets off at 4:00? I actually need to tell myself to goto bed.
    • caliban
      caliban over 14 years
      @Lucas Aardvark : LOL.
    • jamuraa
      jamuraa over 14 years
      I get off work at 4:00pm.. then again, I get in to work at 7am most days..
    • SDsolar
      SDsolar almost 7 years
      This is great. I was just asking about something like this at askubuntu.com/questions/936645/…
    • SDsolar
      SDsolar almost 7 years
      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.
  • Ryan C. Thompson
    Ryan C. Thompson over 14 years
    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
  • jamuraa
    jamuraa over 14 years
    True, I forgot about that little annoyance.
  • arxpoetica
    arxpoetica over 14 years
    I liked your solution best because it can be easily changed and doesn't require root access to edit /etc/crontab
  • fixer1234
    fixer1234 over 7 years
    Welcome 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.
  • Kunok
    Kunok about 6 years
    But that doesn't work out of box. notify-send requires some env variables whichr are not available from cron by defaualt?
  • Andrej Herich
    Andrej Herich over 5 years
    You might need to set DBUS_SESSION_BUS_ADDRESS environment variable before running notify-send. See askubuntu.com/a/346580
  • user3439968
    user3439968 about 5 years
    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 .
  • patryk.beza
    patryk.beza almost 5 years
  • nocibambi
    nocibambi almost 3 years
    Is there a way to use this from the "Run a command" (ALT + F2) prompt? notify-send works from there but echo and at does not seem to.