From 811ad9d4f5e907c7064d86db89a40e840b187f55 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 24 Nov 2015 09:53:53 -0400 Subject: found this handy conversion of my blog post to propellor property in spwhitton's repo --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index d6a50309..f428d382 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -929,3 +929,43 @@ userDirHtml = File.fileProperty "apache userdir is html" (map munge) conf munge = replace "public_html" "html" conf = "/etc/apache2/mods-available/userdir.conf" +-- Alarm clock: see +-- +-- +-- oncalendar example value: "*-*-* 7:30" +alarmClock :: String -> User -> String -> Property NoInfo +alarmClock oncalendar (User user) command = combineProperties + "goodmorning timer installed" + [ "/etc/systemd/system/goodmorning.timer" `File.hasContent` + [ "[Unit]" + , "Description=good morning" + , "" + , "[Timer]" + , "Unit=goodmorning.service" + , "OnCalendar=" ++ oncalendar + , "WakeSystem=true" + , "Persistent=false" + , "" + , "[Install]" + , "WantedBy=multi-user.target" + ] + `onChange` (Systemd.daemonReloaded + `before` Systemd.restarted "goodmorning.timer") + , "/etc/systemd/system/goodmorning.service" `File.hasContent` + [ "[Unit]" + , "Description=good morning" + , "RefuseManualStart=true" + , "RefuseManualStop=true" + , "ConditionACPower=true" + , "StopWhenUnneeded=yes" + , "" + , "[Service]" + , "Type=oneshot" + , "ExecStart=/bin/systemd-inhibit --what=handle-lid-switch --why=goodmorning /bin/su " ++ user ++ " -c \"" ++ program ++ "\"" + ] + `onChange` Systemd.daemonReloaded + , Systemd.enabled "goodmorning.timer" + , Systemd.started "goodmorning.timer" + , "/etc/systemd/logind.conf" `File.containsConfPair` + ("Login", "LidSwitchIgnoreInhibited", "no") + ] -- cgit v1.2.3