Skip to content

Instantly share code, notes, and snippets.

@papanikge
Created June 8, 2013 18:37
Show Gist options
  • Save papanikge/5736162 to your computer and use it in GitHub Desktop.
Save papanikge/5736162 to your computer and use it in GitHub Desktop.
alert user after some time interval (sec,min, of hours)
#!/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