Skip to content

Instantly share code, notes, and snippets.

@mpdmanash
Created December 19, 2017 15:44
Show Gist options
  • Save mpdmanash/3b72e7c79ded43f87280fd6e6baa56de to your computer and use it in GitHub Desktop.
Save mpdmanash/3b72e7c79ded43f87280fd6e6baa56de to your computer and use it in GitHub Desktop.
Linux script to follow pomodoro style of work and break.
#!/bin/sh
% add @reboot work/tools/scripts/pomodoro.sh to crontab -e
% or add to sudo nano /etc/rc.local
% or add to "Run at startup" in Ubuntu
study_time_sec="1500"; % in seconds
break_time_sec="300"; % in seconds
% Produced an alarm
_alarm() {
( \speaker-test --frequency $1 --test sine )&
pid=$!
\sleep 0.${2}s
\kill -9 $pid
}
study=true;
while true;
do
if $study ; then
study=false;
notify-send "Come on! Get to work!";
_alarm 100 200;
_alarm 200 200;
_alarm 300 200;
sleep $study_time_sec;
else
study=true;
notify-send "Its time to take some rest";
_alarm 400 200;
_alarm 500 200;
sleep $break_time_sec;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment