Je me suis créé un service que je souhaite lancer toutes les semaines.
En effectuant un
system start backup
il démarre bien et s'exécute correctement.Par contre quand je fait un
system enable backup
j'ai cette erreur:The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.
Mon fichiers:
cat
/etc/systemd/system/backup.service
[Unit]
Description=effectue une sauvegarde
[Service]
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
ExecStart=/home/chocard/scripts/manjaro_sav.sh
cat
/etc/systemd/system/backup.timer
[Unit]
Description=effectue une sauvegarde hebdomadaire ainsi qu'après le démarrage de la machine
[Timer]
OnBootSec=15min # le service démarrera 15 minutes après le démarrage de la machine
OnUnitActiveSec=1w # le service démarrera une fois par semaine, une semaine après la dernière activation du timer
[Install]
WantedBy=timers.target
# sudo systemctl status backup
● backup.service - effectue une sauvegarde
Loaded: loaded (/etc/systemd/system/backup.service; static; vendor preset: disabled)
Active: inactive (dead)
mars 01 13:56:14 localhost systemd[1]: Started effectue une sauvegarde.
Merci pour votre aide