systemd:systemd
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
systemd:systemd [2017/05/06 12:39] – root | systemd:systemd [2017/11/08 20:55] (Version actuelle) – root | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
* [[https:// | * [[https:// | ||
+ | * Recharge / redémarre systemd : | ||
+ | < | ||
+ | $ systemctl daemon-reload | ||
+ | $ systemctl daemon-reexec | ||
+ | </ | ||
+ | |||
+ | * Affiche la liste des dépendances d'une unité : | ||
+ | < | ||
+ | $ systemctl list-dependencies nfs-client.target | ||
+ | nfs-client.target | ||
+ | ● ├─auth-rpcgss-module.service | ||
+ | ● ├─rpc-statd-notify.service | ||
+ | ● └─remote-fs-pre.target | ||
+ | </ | ||
+ | |||
+ | * Afficher une propriété d'un service : | ||
+ | < | ||
+ | $ systemctl show -p " | ||
+ | Wants=rpcbind.socket network-online.target auth-rpcgss-module.service rpc-statd-notify.service nfs-config.service rpc-statd.service nfs-idmapd.service | ||
+ | </ | ||
+ | |||
+ | * Liste l' | ||
+ | < | ||
+ | $ systemd-cgls | ||
+ | </ | ||
+ | |||
+ | * Affiche les uités : | ||
< | < | ||
$ systemctl list-unit-files --type=mount | $ systemctl list-unit-files --type=mount | ||
Ligne 36: | Ligne 63: | ||
7 unit files listed. | 7 unit files listed. | ||
</ | </ | ||
+ | |||
+ | * Modifie un service existant ou en crée un nouveau : | ||
+ | < | ||
+ | $ sudo systemctl edit crond.service | ||
+ | $ | ||
+ | $ #Liste edite le service et recopiant le père | ||
+ | $ sudo systemctl edit crond.service -l | ||
+ | $ sudo systemctl edit crond.service -full | ||
+ | </ | ||
+ | |||
+ | * Date pour timer : | ||
+ | < | ||
+ | Minimal form | ||
+ | Sat, | ||
+ | Mon,Sun 12-*-* 2, | ||
+ | Wed *-1 ==> Wed *-*-01 00:00:00 | ||
+ | Wed-Wed,Wed *-1 ==> Wed *-*-01 00:00:00 | ||
+ | Wed, 17:48 | ||
+ | Wed-Sat,Tue 12-10-15 1:2:3 ==> Tue-Sat 2012-10-15 01:02:03 | ||
+ | *-*-7 0:0:0 ==> *-*-07 00:00:00 | ||
+ | 10-15 ==> *-10-15 00:00:00 | ||
+ | monday *-12-* 17:00 ==> Mon *-12-* 17:00:00 | ||
+ | Mon,Fri *-*-3,1,2 *: | ||
+ | 12, | ||
+ | mon,fri *-1/2-1,3 *: | ||
+ | 03-05 08: | ||
+ | 08: | ||
+ | 05:40 ==> *-*-* 05:40:00 | ||
+ | Sat,Sun 12-05 08: | ||
+ | Sat,Sun 08: | ||
+ | 2003-03-05 05:40 | ||
+ | 2003-03-05 | ||
+ | 03-05 ==> *-03-05 00:00:00 | ||
+ | hourly | ||
+ | daily ==> *-*-* 00:00:00 | ||
+ | monthly | ||
+ | weekly | ||
+ | *: | ||
+ | </ | ||
+ | |||
+ | Some other options like **OnCalendar** are available : | ||
+ | * **OnActiveSec** defines a timer relative to the moment the timer itself is activated. | ||
+ | * **OnBootSec** defines a timer relative to when the machine was booted up. | ||
+ | * **OnStartupSec** defines a timer relative to when systemd was started. | ||
+ | * **OnUnitActiveSec** defines a timer relative to when the unit the timer is activating was last activated. | ||
+ | * **OnUnitInactiveSec** defines a timer relative to when the unit the timer is activating was last deactivated. | ||
+ | |||
+ | Exemple : | ||
+ | < | ||
+ | [Unit] | ||
+ | Description=Execute backup every day at midnight | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar=*-*-* 00:00:00 | ||
+ | Unit=backup.service | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
+ | |||
+ | * 2 moyens d' | ||
+ | * **loginctl enable-linger [user]** : Active les processus persistant pour le user donné (si pas de user alors user courant). L' | ||
+ | * Dans le fichier ''/ | ||
+ |
systemd/systemd.1494074398.txt.gz · Dernière modification : 2017/05/06 12:39 de root