Pop-Up Notification when time reaches 4:00PM?
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
Related videos on Youtube
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, 2022Comments
-
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:
-
Troggy over 14 yearsDo you need to know the exact second you are done with work for the day?
-
arxpoetica over 14 yearsNo. Who gets off at 4:00? I actually need to tell myself to goto bed.
-
caliban over 14 years@Lucas Aardvark : LOL.
-
jamuraa over 14 yearsI get off work at 4:00pm.. then again, I get in to work at 7am most days..
-
SDsolar almost 7 yearsThis is great. I was just asking about something like this at askubuntu.com/questions/936645/…
-
SDsolar almost 7 yearsHere 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 over 14 yearsYou 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 over 14 yearsTrue, I forgot about that little annoyance.
-
arxpoetica over 14 yearsI liked your solution best because it can be easily changed and doesn't require root access to edit
/etc/crontab
-
fixer1234 over 7 yearsWelcome 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 about 6 yearsBut that doesn't work out of box.
notify-send
requires some env variables whichr are not available from cron by defaualt? -
Andrej Herich over 5 yearsYou might need to set
DBUS_SESSION_BUS_ADDRESS
environment variable before running notify-send. See askubuntu.com/a/346580 -
user3439968 about 5 yearsYou need add DISPLAY variable to environment to work with
at
orcron
. Type this:echo 'export DISPLAY=:0; notify-send "Enjoy!"' | at 04:00 PM
. -
patryk.beza almost 5 yearsYou need to
apt install libnotify-bin
to usenotify-send
. -
nocibambi almost 3 yearsIs there a way to use this from the "Run a command" (ALT + F2) prompt?
notify-send
works from there butecho
andat
does not seem to.