diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2013 Martin Stensgård
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/monitor.cabal b/monitor.cabal
new file mode 100644
--- /dev/null
+++ b/monitor.cabal
@@ -0,0 +1,24 @@
+name:               monitor
+version:            0.1.0
+synopsis:           Do things when files change.
+description:        monitor waits for files to change, then runs system commands.
+license:            MIT
+license-file:       LICENSE
+author:             Martin Stensgård
+maintainer:         mastensg@ping.uio.no
+copyright:          (c) 2013 Martin Stensgård
+category:           System
+build-type:         Simple
+cabal-version:      >=1.8
+
+executable monitor
+  main-is:          monitor.hs
+  GHC-Options:      -Wall
+  build-depends:    base == 4.5.*,
+                    hinotify == 0.3.*,
+                    process,
+                    filepath
+
+source-repository head
+    type:           git
+    location:       git://github.com/mastensg/monitor.git
diff --git a/monitor.hs b/monitor.hs
new file mode 100644
--- /dev/null
+++ b/monitor.hs
@@ -0,0 +1,38 @@
+import Data.List
+import System.Environment
+import System.FilePath
+import System.Process
+
+import System.INotify
+
+uniqDirs :: [FilePath] -> [FilePath]
+uniqDirs = nub . map takeDirectory
+
+eventHandler :: String -> [FilePath] -> FilePath -> Event -> IO ()
+eventHandler command paths directory (Modified _ (Just file)) =
+    if elem path paths
+        then system command >> return ()
+        else return ()
+    where
+        path = normalise $ directory </> file
+eventHandler _ _ _ _ = return ()
+
+addWatches :: (FilePath -> Event -> IO ()) -> [FilePath] -> IO [WatchDescriptor]
+addWatches handler paths = do
+    inotify <- initINotify
+    mapM (\p -> addWatch inotify [Modify] p (handler p)) (map normalise paths)
+
+wait :: String -> IO ()
+wait command = do
+    _ <- getLine
+    _ <- system command
+    wait command
+
+parse :: [String] -> IO ()
+parse (command:paths) = do
+    _ <- addWatches (eventHandler command paths) $ uniqDirs paths
+    wait command
+parse [] = print "Usage: monitor 'commands' [file ...]"
+
+main :: IO ()
+main = getArgs >>= parse
