Outils pour utilisateurs

Outils du site


linux

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
linux [2026/05/07 08:55] – [TEST PORT] huracanlinux [2026/08/21 13:34] (Version actuelle) – [PLANIFICATION ATQ] huracan
Ligne 4: Ligne 4:
  
   Decouverte new srv: last, env, alias, ps -aux, top, find / -iname "test.txt",   Decouverte new srv: last, env, alias, ps -aux, top, find / -iname "test.txt",
-  grep word /file.txt,ss -tunlp, systemctl list-timers, systemctl --type=service+  grep word /file.txt,ss -tunlp,ss -tan, systemctl list-timers, systemctl --type=service
  
   Pour macro => script audit.txt puis exit pour finir   Pour macro => script audit.txt puis exit pour finir
Ligne 49: Ligne 49:
 === AVEC TELNET === === AVEC TELNET ===
  
-  #telnet <Adresse IP / Hôte> <port>+  #telnet IP port
  
 Lorsque le port distant est ouvert, on obtient ceci : Lorsque le port distant est ouvert, on obtient ceci :
Ligne 109: Ligne 109:
     * Month (1 – 12): Specifies the month when the job will run.     * Month (1 – 12): Specifies the month when the job will run.
     * Day of the week (0 – 7): Specifies the day of the week when the job will run (both 0 and 7 represent Sunday).     * Day of the week (0 – 7): Specifies the day of the week when the job will run (both 0 and 7 represent Sunday).
 +
 +----
 +
 +==== PLANIFICATION ATQ ====
 +
 +Prérequis
 +
 +  # Vérifier que le service atd est actif
 +  #systemctl status atd --no-pager
 +
 +Si le service est inactif
 +
 +Sur un système où vous avez les droits administrateur :
 +
 +  #sudo systemctl enable --now atd
 +
 +1. planifier une tâche unique avec at
 +Dans ce lab, on planifie une écriture dans un fichier de sortie.
 +
 +  mkdir -p /tmp/at-lab
 +  printf '%s\n' 'echo "AT_OK" >> /tmp/at-lab/output.txt' > /tmp/at-lab/job.sh
 +  at -f /tmp/at-lab/job.sh now + 2 minutes
 +
 +Sortie attendue (exemple) :
 +
 +  warning: commands will be executed using /bin/sh
 +  job 9 at Mon Apr 20 21:24:00 2026
 +
 +2. inspecter la file avec atq
 +
 +  #atq
 +
 +Sortie attendue (exemple) :
 +
 +  9       Mon Apr 20 21:24:00 2026 a bob
 +
 +  * première colonne : identifiant du job ;
 +  * date/heure : exécution prévue ;
 +  * dernier champ : utilisateur propriétaire.
 +
 +3. annuler un job avec atrm
 +
 +  # Remplacez 9 par l'identifiant réel
 +  atrm 9
 +  atq
 +
 +Si la file est vide, atq ne retourne rien.
 +
 +4. vérifier l'exécution quand vous ne supprimez pas le job
 +Planifiez une tâche et laissez-la s'exécuter :
 +
 +  #at -f /tmp/at-lab/job.sh now + 1 minute
 +
 +Après ~1 minute :
 +
 +  #cat /tmp/at-lab/output.txt
 +
 +Vous devez voir au moins une ligne AT_OK.
 +
 +Bonnes pratiques
 +
 +  * Utilisez des chemins absolus dans les scripts appelés par at.
 +  * Préférez un script (at -f script.sh) à une commande complexe inline.
 +  * Journalisez la sortie (>> /var/log/... 2>&1) pour faciliter le diagnostic.
 +  * Testez la commande en direct avant de la planifier.
 +
  
 ---- ----
linux.1778136905.txt.gz · Dernière modification : de huracan

DokuWiki Appliance - Powered by TurnKey Linux