From 0c23aa1f1b3486305a6173bf092b34b653340c16 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 3 Aug 2017 11:03:41 -0400 Subject: propellor spin --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/Propellor/Property/SiteSpecific/JoeySites.hs') diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index a48ebf9c..c158ea93 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -931,6 +931,39 @@ alarmClock oncalendar (User user) command = combineProperties "goodmorning timer & "/etc/systemd/logind.conf" `ConfFile.containsIniSetting` ("Login", "LidSwitchIgnoreInhibited", "no") +-- My home power monitor. +homePowerMonitor :: Property DebianLike +homePowerMonitor = propertyList "home power monitor" $ props + & Apache.installed + & Apt.installed ["python2", "python-pymodbus"] + & Apt.installed ["ghc", "make"] + & Git.cloned (User "joey") "git://git.kitenet.net/joey/homepower" d Nothing + `onChange` buildpoller + & Systemd.enabled servicename + `requires` serviceinstalled + where + d = "/var/www/html/homepower" + buildpoller = userScriptProperty (User "joey") + [ "cd " ++ d + , "make" + ] + `assume` MadeChange + servicename = "homepower" + servicefile = "/etc/systemd/system/" ++ servicename ++ ".service" + serviceinstalled = servicefile `File.hasContent` + [ "[Unit]" + , "Description=home power monitor" + , "" + , "[Service]" + , "ExecStart=" ++ d ++ "/poller" + , "WorkingDirectory=" ++ d + , "User=joey" + , "Group=joey" + , "" + , "[Install]" + , "WantedBy=multi-user.target" + ] + -- My home router, running hostapd and dnsmasq for wlan0, -- with eth0 connected to a satellite modem, and a fallback ppp connection. homeRouter :: Property (HasInfo + DebianLike) -- cgit v1.2.3