Created
June 8, 2013 18:37
-
-
Save papanikge/5736162 to your computer and use it in GitHub Desktop.
alert user after some time interval (sec,min, of hours)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "daemons" | |
exit -1 unless ARGV.size == 1 | |
Daemons.daemonize | |
given = ARGV[0] | |
if given =~ /^\d*s$/ | |
how_much = given.chop.to_i | |
elsif given =~ /^\d*m$/ | |
how_much = given.chop.to_i * 60 | |
elsif given =~ /^\d*h$/ | |
how_much = given.chop.to_i * 3600 | |
else | |
puts "alert [s:seconds m:minutes h:hours]" | |
exit -1 | |
end | |
sleep how_much | |
# Notify: | |
`notify-send -u critical -t 3000 "Hey your #{given} are OVER"` | |
`ncmpcpp toggle` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment