Create simple alarm for any task

I want to share a simple script that plays an audio after a custom time. For this you need to install an app called mpv. This is a command line app. Next, you also need an audio. I usually search for some alarm audio.

Let's say I have the audio at ~/bin/media directory with name alarm1.mp3. Following script (alarm.sh) will play it after the given time.

#!/bin/sh
sleep $1 && mpv --loop ~/bin/media/alarm1.mp3

Make sure to make the script executable by using chmod +x alarm.sh command.

Once you have done above setup, you can run the command with any time. The script uses a utility called sleep, which accepts suffixes like s, h and d for seconds (default if nothing is specified), hours and days.

Example

$ alarm.sh 1
$ alarm.sh 10m
$ alarm.sh 1d

Posted Apr 26, 2026, 1:42 AM UTC

10
Loading comments…