diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-11-24 09:58:45 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-11-24 09:58:45 -0400 |
| commit | 38d205fdce91a51b32989d16a33096bd9bcfd2c2 (patch) | |
| tree | c5b07ef33e27751c00b89d5c229a423ab1b9ed24 /src | |
| parent | eaac29e5cdb25102de5a48f4bd54a60c9d8bf24d (diff) | |
| parent | 776c11f6a9187da03324b879e744a8f07b480a09 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/JoeySites.hs | 41 | ||||
| -rw-r--r-- | src/Utility/Scheduled.hs | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index d6a50309..d22eb615 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -6,6 +6,7 @@ module Propellor.Property.SiteSpecific.JoeySites where import Propellor.Base import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.File as File +import qualified Propellor.Property.ConfFile as ConfFile import qualified Propellor.Property.Gpg as Gpg import qualified Propellor.Property.Ssh as Ssh import qualified Propellor.Property.Git as Git @@ -929,3 +930,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 +-- <http://joeyh.name/blog/entry/a_programmable_alarm_clock_using_systemd/> +-- +-- 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 \"" ++ command ++ "\"" + ] + `onChange` Systemd.daemonReloaded + , Systemd.enabled "goodmorning.timer" + , Systemd.started "goodmorning.timer" + , "/etc/systemd/logind.conf" `ConfFile.containsIniSetting` + ("Login", "LidSwitchIgnoreInhibited", "no") + ] diff --git a/src/Utility/Scheduled.hs b/src/Utility/Scheduled.hs index ead8f771..d23aaf03 100644 --- a/src/Utility/Scheduled.hs +++ b/src/Utility/Scheduled.hs @@ -36,6 +36,7 @@ import Data.Time.LocalTime import Data.Time.Calendar import Data.Time.Calendar.WeekDate import Data.Time.Calendar.OrdinalDate +import Data.Time.Format () import Data.Tuple.Utils import Data.Char import Control.Applicative |
