Table des matières
- 2026:
- 2025:
8 billet(s) pour mars 2026
| Notes conteneurs oras artifact OCI | 2026/03/23 21:13 | Jean-Baptiste |
| Notes podman secret | 2026/03/23 15:10 | Jean-Baptiste |
| Notes ansible podman | 2026/03/23 14:08 | Jean-Baptiste |
| Notes podman volume | 2026/03/23 14:00 | Jean-Baptiste |
| Find list - Trouver des fichiers à partir d'une liste | 2026/03/18 14:32 | Jean-Baptiste |
| AWX inventaire vault | 2026/03/17 18:04 | Jean-Baptiste |
| AWX - Configuration git en local (sans serveur web) | 2026/03/05 16:24 | Jean-Baptiste |
| OpenSMTP | 2026/03/03 16:58 | Jean-Baptiste |
Créer une archive tar depuis un find grâce à cpio
Présentation
cpio est à la fois le nom d'une commande et d'un format d'archivage. Voir manuel http://www.gnu.org/software/cpio/manual/cpio.html
La commande cpio prend aussi en charge d'autre format que cpio, comme par exemple le format ustar.
Tar avec cpio
Utilisez l'option '-depth' à find.
find . -depth | cpio -ov --format=ustar |pigz > archive.tar.gz # Équivalent ? find . -depth | xargs tar czf archive.tar.gz find . -exec tar rvf archive.tar "{}" \;
'-depth' pas nécessaire si votre find ne retourne pas de répertoire. Comme avec l'option '-type f' par exemple
find . -type f |cpio -ov --format=ustar |pigz > archive.tar.gz
Si vous avez des noms de fichiers avec des espaces et des caractères bizarres
find . -depth -print0 |cpio -0 -ov --format=ustar |pigz > archive.tar.gz
Il est également possible de créer un tarball depuis un find (ou un ls) avec Pax qui est à privilégier. Cependant contrairement à pax, cpio est livré par défaut dans la plupart des distributions.
Voir Pax
Limitation
Le format d'archive défini par la norme POSIX.1-1988 appelé ustar est très portable. Mais en revanche, il est assez limité.
- Taille max de l'archive : 8GB
- Taille max nom de fichier : 256 caractères grand max (souvent moins)
- Taille max nom lien symbolique : 100 caractères
Voir détails http://www.gnu.org/software/tar/manual/html_section/tar_68.html
Exemple en pratique
Autre CPIO
find . -mount -print | cpio -pdm /mnt/newhost-disk
Autre
Avec Tar
tar -cvf allfiles.tar -T mylist.txt
Table de partitions GPT
Voir :
Supprimer uniquement la table des partitions en conservant la MBR
Install de gdisk (GPT fdisk)
apt-get install gdisk
Suppression de la table GPT - zap GPT
sgdisk --zap /dev/sdb
Supprimer toutes les signatures
/sbin/wipefs -a -f /dev/sda
Autres
# sfdisk /dev/sda /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sda6 /dev/sda7 # sfdisk -d /dev/sda label: gpt label-id: 4A520514-FBFF-49E2-93CD-024C6EE848EA device: /dev/sda unit: sectors first-lba: 34 last-lba: 209715038 /dev/sda1 : start= 2048, size= 97654784, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=763DFFAB-5D82-4843-8F38-746AA9D6D2EE, name="root" /dev/sda2 : start= 97656832, size= 39061504, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0D3A7314-4DC6-4D63-8AD2-A5B514F9FE90, name="home" /dev/sda3 : start= 136718336, size= 9764864, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=91287ED7-760D-405B-ABE7-C7F8FD59DF6B, name="usr" /dev/sda4 : start= 146483200, size= 9764864, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=CA22ECC9-7839-4EE6-8F23-CC67A55D3F8A, name="var" /dev/sda5 : start= 156248064, size= 9764864, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=6D2E0210-27B3-4979-B85B-DCBF2F63BC38, name="tmp" /dev/sda6 : start= 166012928, size= 9764864, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=BC2EAA0E-BFF8-4311-B738-8DEC70F0DA91, name="usr/local" /dev/sda7 : start= 175777792, size= 9764864, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=EA73FFAD-DB9B-476B-B40F-DAF95DFF0C14, name="efi" # gdisk -l /dev/sda GPT fdisk (gdisk) version 1.0.3 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 209715072 sectors, 100.0 GiB Model: PERC H330 Adp Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 4A520514-FBFF-49E2-93CD-024C6EE848EA Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 209715038 Partitions will be aligned on 2048-sector boundaries Total free space is 24174397 sectors (11.5 GiB) Number Start (sector) End (sector) Size Code Name 1 2048 97656831 46.6 GiB 8300 root 2 97656832 136718335 18.6 GiB 8300 home 3 136718336 146483199 4.7 GiB 8300 usr 4 146483200 156248063 4.7 GiB 8300 var 5 156248064 166012927 4.7 GiB 8300 tmp 6 166012928 175777791 4.7 GiB 8300 usr/local 7 175777792 185542655 4.7 GiB EF00 efi
Table caractere speciaux unicode utf8
Voir :
Voir aussi
| Car | Code | Nom | Commentaire |
|---|---|---|---|
| | | 007C | Pipe | |
| ♯ | 266F | Dièse | |
| # | 0023 | Croisillon | Appelé à tort Dièse |
| ✓ | 2713 | Coché / check mark | |
| ✗ | 2717 | Croix | |
| ☐ | 2610 | Case non cochée | |
| ☑ | 2611 | Case cochée | |
| ☒ | 2612 | Case cochée d'un X | |
| ☎ | 260E | Téléphone noir | |
| ☏ | 260F | Téléphone blanc | |
| 📱 | 1F4F1 | Téléphone portable | |
| ✉ | 2709 | Courrier / Lettre | |
| → | 2192 | Flèche | Chimie : réactifs → produits |
| ⇒ | 21D2 | Flèche | Logique |
| 🐫 | 1F42B | Chameau | |
| ☠ | 2620 | Tête de mort | |
| 🎅 | 1F385 | Père Noël | |
| 🎁 | 1F381 | Cadeau | |
| ❤ | 2764 | Cœur / Amour | |
| ♡ | 2661 | Cœur / Amour | |
| ❥ | 2765 | Cœur / Amour | |
| 💖 | 1F496 | Cœur Étincelant | |
| 🥐 | F950 | Croissant | |
| 🎨 | 1F3A8 | Palette artiste penture | |
| 🍍 | 1F34D | Ananas | |
| ✅ | 2705 | White heavy check mark | |
| … | 2026 | horizontal ellipsis | etc… |
| Ñ | 00D1 | Español eñe | |
| ñ | 00F1 | Español eñe | |
| ¡ | 00A1 | Español | |
| ¿ | 00BF | Español | |
| ø | 00F8 | Zéro barré (minuscule) | Alt Gr + S |
| Ø | 00D8 | Zéro barré (majuscule) | Shit + Alt Gr + S |
| ⏳ | 23F3 | Sablier | |
| 😇 | 1F607 | Saint | Emoji |
| 💐 | 1F490 | Bouquet de fleurs | |
| 🎶 | 1F3B6 | Multiple Musical Notes | |
| 🙏 | 1F64F | Mains jointes / Prière | UDP |
| 📰 | 1F4F0 | Journal | newspaper |
| ☣ | 2623 | Biohazard | |
| ❗️ | 2757 | Heavy Exclamation Mark | |
| 🔥 | 1F525 | Feu | |
| ½ | 00BD | 1/2, fraction un demi | |
| 🕊 | 1F54A | Colombe de la paix | |
| ⚠️ | 26A0 / FE0F | Warning | |
| ♻️ | 267B | Recyclage | |
| æ | 00E6 | Lettre minuscule latine | |
| Æ | 00C6 | Lettre majuscule latine | |
| ☧ | 2627 | Chrisme | In hoc signo vinces |
| 📅 | 1F4C5 | Calendrier | |
| 🗓 | 1F5D3 | Calendrier à spirale | |
| 👀 | 1F440 | Yeux | |
| 🚧 | 1F6A7 | En chantier | |
| 🔜 | 1F51C | Bientôt | |
| 🛠️ | 1F6E0 | Travail | |
| 👍 | 1F44D | Pouce vers le haut |
Symbole Unicode «» (U+)
SystemD service script en boucle infinie respawn
/etc/systemd/system/startPeriodicCheck.service
[Unit] Description=startPeriodicCheck [Service] #ExecStartPre=/bin/sleep 30 ExecStart=/bin/curl 127.1/WebCoding/services/PeriodicCheck.php KillMode=process Restart=always RestartSec=10s [Install] WantedBy=multi-user.target
systemctl daemon-reload
systemctl start startPeriodicCheck
systemctl enable startPeriodicCheck
Dans notre exemple une crontab aurait très bien pu faire l'affaire.
Ou encore :
/etc/systemd/system/plop.service
[Unit] Description=Plop After=getty.target [Service] User=user1 Group=user1 # Default : Type=simple Type=simple ExecStart=/home/user1/bin/plop Restart=always [Install] WantedBy=multi-user.target
SystemD service - exemples
Voir aussi :
Diagnostic d'un service
Source : https://wiki.archlinux.org/title/Systemd_(Fran%C3%A7ais)#Diagnostic_d'un_service
Si un service systemd se comporte mal ou si vous souhaitez obtenir plus d'informations sur ce qui se passe, définissez la SYSTEMD_LOG_LEVEL {[variable d'environnement]] à SYSTEMD_LOG_LEVEL. [à debug. Par exemple, pour exécuter le daemon systemd-networkd en mode débogage :
Ajoutez un Fichiers de substitution pour le service en ajoutant les deux lignes :
[Service] Environment=SYSTEMD_LOG_LEVEL=debug
Ou comme équivalent, définissez la variable d'environnement manuellement :
# SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd
puis redémarrer systemd-networkd et regarder le journal du service avec l'option -f/--follow.
Exemple conf
Exemple conf proxy
/etc/systemd/system/docker.service.d/http-proxy.conf
[Service] # Environment="HTTP_PROXY=http://192.168.56.1:3128/" "HTTPS_PROXY=http://192.168.56.1:3128/" "NO_PROXY=localhost,127.0.0.0/8,192.168.0.0/16,docker-1" Environment="ALL_PROXY=http://192.168.56.1:3128/" "NO_PROXY=localhost,127.0.0.0/8,192.168.0.0/16,docker-1"
systemctl daemon-reload
systemctl show --property=Environment docker
systemctl restart docker
Désactiver un service si un fichier est présent
/lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf
[Unit] # don't run timesyncd if we have another NTP daemon installed #ConditionFileIsExecutable=!/usr/sbin/VBoxService
Arguments utiles
Environment=NODE_ENV=production
Command systemd-run
https://blog.octo.com/5-services-que-systemd-ma-deja-rendu/
#systemd-run --user systemd-run --on-active=10 /bin/bash -c "echo 'Bip!' >>'/var/log/spoutnik.log'
https://wiki.archlinux.org/index.php/Systemd/Timers
systemd-run --on-active="12h 30m" --unit someunit.service
https://www.systutorials.com/docs/linux/man/1-systemd-run/
systemd-run -p BlockIOWeight=10 updatedb systemd-run --on-active=30 --timer-property=AccuracySec=100ms /bin/touch /tmp/foo
Exemple
Exemple 1
Source : https://confluence.atlassian.com/confkb/run-confluence-as-a-systemd-service-on-linux-937177781.html
touch /lib/systemd/system/confluence.service chmod 664 /lib/systemd/system/confluence.service
vi /lib/systemd/system/confluence.service
/lib/systemd/system/confluence.service
[Unit] Description=Confluence After=network.target [Service] Type=forking User=confluence PIDFile=/opt/atlassian/confluence/work/catalina.pid ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh ExecStop=/opt/atlassian/confluence/bin/stop-confluence.sh TimeoutSec=200 LimitNOFILE=2048 LimitNPROC=2048 [Install] WantedBy=multi-user.target
Vérif syntax
systemd-analyze verify /lib/systemd/system/confluence.service
systemctl daemon-reload
systemctl enable confluence.service
systemctl start confluence.service
systemctl status confluence.service
Exemple 2
https://wiki.archlinux.org/index.php/Advanced_Format
/etc/systemd/system/lcc_fix.service
[Unit] Description=WDIDLE3 [Service] Type=oneshot ExecStart=/usr/bin/hdparm -J 300 --please-destroy-my-drive /dev/sdX TimeoutSec=0 StandardInput=tty RemainAfterExit=yes UMask=006 [Install] WantedBy=multi-user.target
Exemple 3
Source : https://fabianlee.org/2017/05/21/golang-running-a-go-binary-as-a-systemd-service-on-ubuntu-16-04/
/lib/systemd/system/sleepservice.service
[Unit] Description=Sleep service ConditionPathExists=/home/ubuntu/work/src/sleepservice/sleepservice After=network.target [Service] Type=simple User=sleepservice Group=sleepservice LimitNOFILE=1024 Restart=on-failure RestartSec=10 startLimitIntervalSec=60 WorkingDirectory=/home/ubuntu/work/src/sleepservice ExecStart=/home/ubuntu/work/src/sleepservice/sleepservice --name=foo # make sure log directory exists and owned by syslog PermissionsStartOnly=true ExecStartPre=/bin/mkdir -p /var/log/sleepservice ExecStartPre=/bin/chown syslog:adm /var/log/sleepservice ExecStartPre=/bin/chmod 755 /var/log/sleepservice StandardOutput=syslog StandardError=syslog SyslogIdentifier=sleepservice [Install] WantedBy=multi-user.target
Exemple 4 - SystemD appelant un script sysV init
Exemple avec SonarQube
/etc/systemd/system/sonar.service
[Unit] Description=Sonar 6 After=network.target network-online.target Wants=network-online.target [Service] ExecStart=/home/sonar/sonarqube-6.7.1/bin/linux-x86-64/sonar.sh start ExecStop=/home/sonar/sonarqube-6.7.1/bin/linux-x86-64/sonar.sh stop ExecReload=/home/sonar/sonarqube-6.7.1/bin/linux-x86-64/sonar.sh restart PIDFile=/home/sonar/sonarqube-6.7.1/bin/linux-x86-64/./SonarQube.pid Type=forking User=sonar [Install] WantedBy=multi-user.target
Exemple Jenkins slave agent
Jenkins-agent.service
[Unit] Description=Jenkins Service Wants=network.target After=network.target [Service] ExecStart=/usr/bin/java -jar /home/user1/slave2.jar -jnlpUrl http://jenkins:8080/computer/SERVER01/slave-agent.jnlp User=user1 Restart=always [Install] WantedBy=multi-user.target
Exemple Postgres
/usr/local/lib/systemd/system/postgres_plop_rct.service
[Unit] Description=postgresql_plop_rct_service After=network.target AssertPathExists=!/etc/noprod [Service] Type=forking User=postgres #Disable OOM kill on postmaster OOMScoreAdjust=-1000 Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj Environment=PG_OOM_ADJUST_VALUE=0 WorkingDirectory=/tools/list/postgres/script/bin ExecStart=/tools/list/postgres/script/bin/rc_postgres.ksh start plop_rct ExecStop=/tools/list/postgres/script/bin/rc_postgres.ksh stop plop_rct ExecReload=/bin/kill -HUP $MAINPID Restart=on-abort KillMode=mixed KillSignal=SIGINT TimeoutSec=0 [Install] WantedBy=multi-user.target
Exemple AAP - Tirer des dépendances seulement
/etc/systemd/system/automation-controller.service
[Unit] Description=Automation Controller service After=network.target redis.service nginx.service supervisord.service receptor.service Wants=redis.service nginx.service supervisord.service receptor.service [Service] Type=oneshot RemainAfterExit=true ExecStart=/bin/true [Install] WantedBy=multi-user.target
Exemple iptables-service de RedHat
/usr/lib/systemd/system/iptables.service
[Unit] Description=IPv4 firewall with iptables After=syslog.target AssertPathExists=/etc/sysconfig/iptables [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/libexec/iptables/iptables.init start ExecReload=/usr/libexec/iptables/iptables.init reload ExecStop=/usr/libexec/iptables/iptables.init stop Environment=BOOTUP=serial Environment=CONSOLETYPE=serial StandardOutput=syslog StandardError=syslog [Install] WantedBy=basic.target
/usr/libexec/iptables/iptables.init
#!/bin/bash # # iptables Start iptables firewall # # chkconfig: 2345 08 92 # description: Starts, stops and saves iptables firewall # # config: /etc/sysconfig/iptables # config: /etc/sysconfig/iptables-config # ### BEGIN INIT INFO # Provides: iptables # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop iptables firewall # Description: Start, stop and save iptables firewall ### END INIT INFO # Source function library. . /etc/init.d/functions #------------------------------------------------ case "$1" in start) [ -f "$VAR_SUBSYS_IPTABLES" ] && exit 0 start RETVAL=$? ;; stop) [ "x$IPTABLES_SAVE_ON_STOP" = "xyes" ] && save stop RETVAL=$? ;; restart|force-reload) restart RETVAL=$? ;; reload) [ -e "$VAR_SUBSYS_IPTABLES" ] && reload RETVAL=$? ;; condrestart|try-restart) [ ! -e "$VAR_SUBSYS_IPTABLES" ] && exit 0 restart restart RETVAL=$? ;; status) status RETVAL=$? ;; panic) set_policy DROP RETVAL=$? ;; save) save RETVAL=$? ;; *) echo $"Usage: ${IPTABLES} {start|stop|reload|restart|condrestart|status|panic|save}" RETVAL=2 ;; esac exit $RETVAL
Exemple Nagios
nagios4.service
[Unit] Description=nagios4 Documentation=man:nagios4 [Service] Environment=NAGIOSCFG="/etc/nagios4/nagios.cfg" EnvironmentFile=/etc/default/nagios4 ExecStartPre=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"' ExecStart=/usr/sbin/nagios4 ${NAGIOSCFG} ExecStopPost=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"' ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed PIDFile=/run/nagios4/nagios.pid [Install] WantedBy=multi-user.target
