A story about how Linux helps my wife take her medication at the right times

reddit

My wife is a transplant recipient and so she has to take her immunosuppressant drugs 4 times a day.

Initially we have used our phones (Android) to alert us at specific times, but over time we found that the Android Alarm app is unreliable, it works most of the time but there were times it failed to trigger the alarm.

Being a Linux user and a programmer for most of my life I thought there was something I could do, I remember looking for existing solutions, but most of them were too limited or expensive.

I resorted to using the at(1) command at first, which worked fine for a while but I never found a way to make the timer as accurate as possible.

After trying different things we ended up with this solution:

A timer file:

~/.config/systemd/user/alarmclock.timer [Unit] Description=Run alarm clock daily [Timer] OnCalendar=8,9,20,21:00 AccuracySec=1us [Install] WantedBy=timers.target 

AccuracySec=1us is important to get the best accuracy, which is what lead me to use systemd timers in the first place (I couldn't find how to do this with crond before).

And the corresponding service file:

# ~/.config/systemd/user/alarmclock.service [Unit] Description=Alarm Clock [Service] ExecStart=/usr/bin/mpv --no-terminal --loop-file=3 /home/user/Downloads/sedna_ringtone.mp3 

It's by no means a perfect solution, but it's reliable and works for my wife, the important thing to remember is to never close the laptop lid.

Many thanks to the whole GNU/Linux community.

submitted by /u/micoseciumento
[link] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *