/usr/sbin/novaboot-power
/usr/bin/novaboot-shell
/usr/lib/systemd/user/novaboot-delayed-power-off.service
+/usr/lib/systemd/user/novaboot-delayed-power-off.target
/usr/lib/sysusers.d/novaboot-server.conf
/usr/sbin/adduser-novaboot
/usr/share/man/man1/novaboot-shell.1
install -D -m 644 -t $(DESTDIR)/lib/systemd/system systemd/novaboot-power-off@.timer
install -D -m 644 -t $(DESTDIR)/lib/systemd/system systemd/novaboot-power@.service
install -D -m 644 -t $(DESTDIR)/usr/lib/systemd/user systemd/novaboot-delayed-power-off.service
+ install -D -m 644 -t $(DESTDIR)/usr/lib/systemd/user systemd/novaboot-delayed-power-off.target
install -D -m 440 systemd/sudoers.novaboot-server $(DESTDIR)/etc/sudoers.d/novaboot-server
install -D -m 755 -t $(DESTDIR)$(PREFIX)/sbin systemd/novaboot-power
=head2 Automatic power-off
When your system uses L<systemd(1)>, you can configure a systemd
-service to automatically power-off the target after timeout. To enable
-this run:
-
- systemctl --user enable novaboot-delayed-power-off
-
-as the created user (e.g. via shell subcommand). To enable delayed
-power-off for all novaboot-shell account, run the follwing as root:
-
- systemctl --global enable novaboot-delayed-power-off
-
-Individual accounts may disable this global configuration by running:
-
- systemctl --user mask novaboot-delayed-power-off
-
-The power-off timeout is hardcoded in the B<novaboot-power-off@.timer>
-unit. To override the timeout, run C<systemctl edit
-novaboot-power-off@TARGET.timer> for your B<TARGET> and insert the
-following to the spawned editor:
-
- [Timer]
- OnActiveSec=30min
+service to automatically power-off the target after a timeout. See
+C<novaboot-delayed-power-off> in L<novaboot-shell(1)>.
=head1 OPTIONS
=item off_cmd
-Command to C<exec> that powers the target off.
+Command to C<exec> that powers the target off. This command is
+executed either explicitly, when novaboot-shell C<off> command is
+invoked or automatically, after the last novaboot-shell session
+finishes and the C<novaboot-delayed-power-off> systemd user service is
+enabled (see below).
=item target_config
=back
+=head1 AUTOMATIC POWER OFF
+
+The target can be automatically powered off when the last session
+finishes. This can be enabled by running:
+
+ systemctl --user enable novaboot-delayed-power-off
+
+perhaps via the C<shell> subcommand. To enable delayed power-off for
+all novaboot-shell accounts, run the follwing as root:
+
+ systemctl --global enable novaboot-delayed-power-off
+
+Individual accounts may disable this global configuration by running:
+
+ systemctl --user mask novaboot-delayed-power-off
+
+When C<novaboot-delayed-power-off> is enabled, the I<on> and I<off>
+commands are executed via systemd rather than by C<novaboot-shell>
+directly. The delay between the end of the session and power off is
+hardcoded in the B<novaboot-power-off@.timer> unit. To override the
+timeout for individual targets, run:
+
+ systemctl edit novaboot-power-off@TARGET.timer
+
+for your B<TARGET> (the user running C<novaboot-shell>) and insert the
+following to the spawned editor:
+
+ [Timer]
+ OnActiveSec=30min
+
=head1 AUTHORS
Michal Sojka <sojkam1@fel.cvut.cz>
Type=oneshot
ExecStop=/usr/bin/sudo novaboot-power delayed-off
RemainAfterExit=true
+
+[Install]
+WantedBy=novaboot-delayed-power-off.target
--- /dev/null
+# This unit serves only as a placeholde that allows enabling and
+# disabling novaboot-delayed-power-off.service. We don't use this
+# targer for anything.
+[Unit]
+Description=Novaboot power on target
+Documentation=man:novaboot-shell(1)
+[Unit]
+# Don't allow starting the timer if the target is already powered off
+Requisite=novaboot-power@%i.service
+After=novaboot-power@%i.service
+# If somebody powers off the target explicitly stop the timer (if running) too
+PartOf=novaboot-power@%i.service
+
[Timer]
OnActiveSec=10min
Unit=novaboot-power-off@%i.service