Created
July 17, 2014 03:46
-
-
Save dorentus/fa56408220aec640eca4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'rb-inotify' | |
if ARGV.count < 3 | |
puts "Usage: #{File.basename $0} <path> <signal> <cmd>" | |
exit 1 | |
end | |
path = ARGV[0] | |
signal = ARGV[1].to_sym | |
cmd = ARGV[2] | |
notifier = INotify::Notifier.new | |
notifier.watch path, signal do |event| | |
system cmd | |
end | |
notifier.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://fortune.106.187.88.242.xip.io
watch-and-run /var/opt/sites/any.xip.io/public/index.txt access "/usr/games/fortune -s > /var/opt/sites/any.xip.io/public/index.txt"