scripts

random scripts
git clone https://git.parazyd.org/scripts
Log | Files | Refs

alarmclock (386B)


      1 #!/bin/sh
      2 
      3 wattime="${1:-10:40}"
      4 
      5 currentime=$(date +%s)
      6 wakeuptime=$(date -d "today $wattime" +%s)
      7 howmuchslp=$(( $wakeuptime - $currentime ))
      8 
      9 printf "(*) armed at %s!\\n" "$wattime"
     10 printf "(*) you'll be getting about %d hours of sleep\\n" "$(( $howmuchslp / 60 / 60 ))"
     11 printf "(*) good night!\\n"
     12 
     13 sleep "$howmuchslp"
     14 amixer set Master 100
     15 mpv --loop $HOME/music/WAKEUP.mp3
     16 exit 0