Merge pull request #1815 from dalto8/timer
[services-systemd] Add support for timers
This commit is contained in:
commit
7aaefa42d1
@ -63,6 +63,8 @@ def systemctl(targets, command, suffix):
|
|||||||
description = _("Cannot enable systemd service <code>{name!s}</code>.")
|
description = _("Cannot enable systemd service <code>{name!s}</code>.")
|
||||||
elif command == "enable" and suffix == ".target":
|
elif command == "enable" and suffix == ".target":
|
||||||
description = _("Cannot enable systemd target <code>{name!s}</code>.")
|
description = _("Cannot enable systemd target <code>{name!s}</code>.")
|
||||||
|
elif command == "enable" and suffix == ".timer":
|
||||||
|
description = _("Cannot enable systemd timer <code>{name!s}</code>.")
|
||||||
elif command == "disable" and suffix == ".service":
|
elif command == "disable" and suffix == ".service":
|
||||||
description = _("Cannot enable systemd service <code>{name!s}</code>.")
|
description = _("Cannot enable systemd service <code>{name!s}</code>.")
|
||||||
elif command == "disable" and suffix == ".target":
|
elif command == "disable" and suffix == ".target":
|
||||||
@ -97,6 +99,10 @@ def run():
|
|||||||
if r is not None:
|
if r is not None:
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
r = systemctl(cfg.get("timers", []), "enable", ".timer")
|
||||||
|
if r is not None:
|
||||||
|
return r
|
||||||
|
|
||||||
r = systemctl(cfg.get("disable", []), "disable", ".service")
|
r = systemctl(cfg.get("disable", []), "disable", ".service")
|
||||||
if r is not None:
|
if r is not None:
|
||||||
return r
|
return r
|
||||||
|
@ -3,24 +3,24 @@
|
|||||||
#
|
#
|
||||||
# Systemd services manipulation.
|
# Systemd services manipulation.
|
||||||
#
|
#
|
||||||
# This module can enable services and targets for systemd
|
# This module can enable services, timers and targets for systemd
|
||||||
# (if packaging doesn't already do that). It can calso
|
# (if packaging doesn't already do that). It can also
|
||||||
# disable services (but not targets).
|
# disable services and targets as well as mask units.
|
||||||
#
|
#
|
||||||
# First, services are enabled; then targets; then services
|
# The order of operations is fixed. Enable services, enable targets,
|
||||||
# are disabled -- this order of operations is fixed.
|
# enable timers, disable services, disable targets and finally apply masks.
|
||||||
---
|
---
|
||||||
|
|
||||||
# There are three configuration keys for this module:
|
# There are several configuration keys for this module:
|
||||||
# *services*, *targets* and *disable*. The value of each
|
# *services*, *targets*, *timers*, *disable*, *disable-targets* and *mask*.
|
||||||
# key is a list of entries. Each entry has two keys:
|
# The value of each key is a list of entries. Each entry has two keys:
|
||||||
# - *name* is the (string) name of the service or target that is being
|
# - *name* is the (string) name of the service or target that is being
|
||||||
# changed. Use quotes. Don't include ".target" or ".service"
|
# changed. Use quotes. Don't include unit suffix in the name. For
|
||||||
# in the name.
|
# example, it should be "NetworkManager", not "NetworkManager.service"
|
||||||
# - *mandatory* is a boolean option, which states whether the change
|
# - *mandatory* is a boolean option, which states whether the change
|
||||||
# must be done successfully. If systemd reports an error while changing
|
# must be done successfully. If systemd reports an error while changing
|
||||||
# a mandatory entry, the installation will fail. When mandatory is false,
|
# a mandatory entry, the installation will fail. When mandatory is false,
|
||||||
# errors for that entry (service or target) are ignored. If mandatory
|
# errors for that systemd unit are ignored. If mandatory
|
||||||
# is not specified, the default is false.
|
# is not specified, the default is false.
|
||||||
#
|
#
|
||||||
# An entry may also be given as a single string, which is then
|
# An entry may also be given as a single string, which is then
|
||||||
@ -46,6 +46,11 @@
|
|||||||
# - name: "graphical"
|
# - name: "graphical"
|
||||||
# mandatory: true
|
# mandatory: true
|
||||||
#
|
#
|
||||||
|
# # Enables <name>.timer
|
||||||
|
# timers:
|
||||||
|
# - name: "fstrim"
|
||||||
|
# mandatory: false
|
||||||
|
#
|
||||||
# # Disables <name>.service
|
# # Disables <name>.service
|
||||||
# disable:
|
# disable:
|
||||||
# - name: "pacman-init"
|
# - name: "pacman-init"
|
||||||
@ -68,6 +73,7 @@
|
|||||||
# By default, no changes are made.
|
# By default, no changes are made.
|
||||||
services: []
|
services: []
|
||||||
targets: []
|
targets: []
|
||||||
|
timers: []
|
||||||
disable: []
|
disable: []
|
||||||
disable-targets: []
|
disable-targets: []
|
||||||
mask: []
|
mask: []
|
||||||
|
Loading…
Reference in New Issue
Block a user