[Unit] Description=Ekklesia Classroom presentation import Documentation=file:///usr/local/bin/classroom-presentation-import # Nothing graphical: it copies, converts and renders files. It is a user # service rather than a system one because the downloads it watches and # the library it fills both belong to the classroom account, and a root # service writing into a teacher's home would have to be told about every # one of those permissions. PartOf=graphical-session.target [Service] ExecStart=/usr/local/bin/classroom-presentation-import # It exits 0 immediately on a device with PRESENTATIONS_ENABLED=false, and # on-failure means such a device is left alone rather than restarted in a # loop forever. A device that does have Presentations gets the watcher # back if it ever dies, because a teacher whose download never appears has # no way at all to find out why. Restart=on-failure RestartSec=10 Slice=session.slice # LibreOffice converting a large deck must never be what a teacher notices # about the machine. The room's own applications come first; this is the # only thing here that is allowed to take a while. Nice=10 IOSchedulingClass=idle # MEMORY. Measured in the lab, LibreOffice converting one deck: 203 MB # for ten slides of text, 738 MB for thirty slides sharing twelve photos, # 1.4 GB for thirty different photos and 2.1 GB for twenty very large # ones, for twenty seconds or so. A 4 GB classroom running Plasma and # Wonder Ink does not have 2 GB spare, and in testing the kernel killed # the whole service mid-conversion — which then restarted and tried the # same deck again, while the library said "Getting this ready" for ever. # # At most 40% of this machine's memory: 1.6 GB on 4 GB, 3.2 GB on 8 GB. # A deck that needs more is stopped HERE, inside this service, rather # than pushing the teacher's own windows out of memory. MemoryMax=40% # If memory runs short everywhere, this is what goes first: never the # lesson on the screen, the browser or the panel. OOMScoreAdjust=800 # And a killed LibreOffice is a failed import, not a dead service. The # watcher records it — "needed more memory", with Try again — and carries # on. systemd's default stops the whole unit when any one process in it # is killed for memory. OOMPolicy=continue [Install] WantedBy=plasma-workspace.target