On Sun, 20 Mar 2022 23:03:52 -0700 Samuel Wales <samolog...@gmail.com> wrote:
> i have to have all lights and monitors off at night. but i have to > know the time so i can take medicine. > > i use slock and turn off monitor with ddccontrol. this might turn off > mouse and keyboard; i wouild have to check. > > i want debian to tell me the time at certain times. for example > tonight i have to take medicine at 2:40 am. > > here are ideas: > > - tell me time when i right click [kb much less accessible] > - tell me at a prespecified time like 2.40 am > - tell me the following hours: midnight, 1 am, 2am > > any would be ok i think. There are a number of ways you could approach this, depending largely on whether you want the simplest way to get a reminder at one specific time vs a flexible talking reminder system. Personally, I would use a custom systemd timer unit for this. Systemd is already running most of your system, and it offers a scheduling syntax that is (AFAIK) more flexible than cron's, and (IMHO) much easier to read. For example "Every day, once an hour, on the hour, but only between midnight and 07:00 (inclusive)" would be: OnCalendar=00..07:00 The timer unit in turn triggers a service unit, which can run a command such as `aplay /home/sam/medicine.wav` like Dan's example, if you want a single-purpose pre-recorded message. Or you could use a command like `espeak-ng "It is now $(date +%R)"` so it'll simply announce the current time whenever it's triggered, thus giving you a general-purpose talking clock. Note that if you make the timer/service unit pair "system" units (in /etc/systemd/system), they'll run (as root) as long as the machine is up and running. If you make them "user" units (in ~/.config/systemd/user/), by default they'll run only when you're logged in. If you want to have user units run when the user is not logged in, the systemd terminology for that is "enable lingering". If you're not familiar with the syntax of systemd unit files, there is a bit of a learning curve, but I'd bet that if you can script in Bash, it won't take you long to get to the point where you can write a minimal timer and service unit pair for a job like this. Cheers! -Chris