31-05-2020
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
To list systemd services we will use systemctl command as below
|
||||
# systemctl list-unit-files
|
||||
|
||||
To list active systemd services run
|
||||
Lister tous les services actifs
|
||||
# systemctl | more
|
||||
|
||||
# systemctl list-units --type service
|
||||
@@ -19,11 +19,17 @@ You can pipe the output to grep to search a more specific service as shown below
|
||||
To check the services alongside the ports they are listening.
|
||||
# netstat -pnltu
|
||||
|
||||
For example, to check if OpenSSH is running on your system, run
|
||||
|
||||
Savoir si le service est actif
|
||||
# systemctl is-active sshd
|
||||
|
||||
Connaitre le status dans service (affiche plud d'info que is-active)
|
||||
# systemctl status sshd
|
||||
|
||||
Alternatively, you can use the syntax below to check if the service is active
|
||||
# systemctl is-active sshd
|
||||
Savoir si le service a eu un problème au démarrage
|
||||
# systemctl is-failed sshd
|
||||
|
||||
|
||||
|
||||
o check if OpenSSH is enabled, run
|
||||
# systemctl is-enabled sshd
|
||||
@@ -34,5 +40,48 @@ check the status of OpenSSH, run
|
||||
|
||||
You can also check all services by running
|
||||
# chkconfig --list
|
||||
|
||||
|
||||
Activer un service au démarrage
|
||||
# systemctl enable sshd
|
||||
|
||||
Désactiver un service au démarrage
|
||||
# systemctl disable sshd
|
||||
|
||||
|
||||
Démarrer un service
|
||||
# systemctl start sshd
|
||||
|
||||
Arreter un service
|
||||
# systemctl stop sshd
|
||||
|
||||
Redémarrer un service
|
||||
# systemctl restart sshd
|
||||
|
||||
Recharger la configuraation d'un service
|
||||
# systemctl reload sshd
|
||||
|
||||
|
||||
Voir la configuration d'un service
|
||||
# systemctl cat sshd
|
||||
|
||||
Propriétés d'un service
|
||||
# systemctl show sshd
|
||||
|
||||
Editer un service
|
||||
# systemctl edit sshd
|
||||
|
||||
Masquer un service, c'est à dire d'empêcher le démarrage manuel et automatique de l'unité. Il suffit alors de la démasquer pour pouvoir l'utiliser à nouveau
|
||||
# systemctl mask httpd.service
|
||||
Created symlink from /etc/systemd/system/httpd.service to /dev/null.
|
||||
# systemctl start httpd.service
|
||||
Failed to start httpd.service: Unit is masked.
|
||||
# systemctl unmask httpd.service
|
||||
Removed symlink /etc/systemd/system/httpd.service.
|
||||
# systemctl start httpd.service
|
||||
|
||||
Afficher les dépendances d'un service
|
||||
# systemctl list-dependencies sshd.service
|
||||
```
|
||||
|
||||
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
|
||||
Reference in New Issue
Block a user