cron

Demande d'aide : c'est ici.
Répondre
austrasien
Membre
Membre
Messages : 28
Inscription : 25 sept. 2024, 12:13
Status : Hors-ligne

bonjour
J'ai placé cette commande de sauvegarde de mes données utilisateur dans anacrontab.

Code : Tout sélectionner

rsync -av --delete-after --exclude-from='/home/christian2/exclus.txt' /home/christian2 /media/christian2/Box/home
Constatant un fort ralentissement du système pendant l'exécution de cette commande, j'ai regardé les process en cours. Voilà ce que ça donne :

Code : Tout sélectionner

root       49207  0.0  0.0   2576   776 ?        S    08:40   0:00 /bin/sh -c rsync -av --delete-after --exclude-from='/home/christian2/exclus.txt' /home/christian2 /media/christian2/Box/home
root       49208  1.6  0.1  12332  7884 ?        D    08:40   0:24 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
root       49209  0.0  0.1  11752  7212 ?        S    08:40   0:00 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
root       49210  2.1  0.0  12012  4748 ?        S    08:40   0:31 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
Je ne comprends pas pourquoi la commande apparaît 4 fois ?
Merci
Avatar de l’utilisateur
zargos
Membre
Membre
Messages : 197
Inscription : 07 juil. 2023, 13:34
Status : Hors-ligne

austrasien a écrit : 07 déc. 2024, 09:23

Code : Tout sélectionner

root       49207  0.0  0.0   2576   776 ?        S    08:40   0:00 /bin/sh -c rsync -av --delete-after --exclude-from='/home/christian2/exclus.txt' /home/christian2 /media/christian2/Box/home
root       49208  1.6  0.1  12332  7884 ?        D    08:40   0:24 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
root       49209  0.0  0.1  11752  7212 ?        S    08:40   0:00 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
root       49210  2.1  0.0  12012  4748 ?        S    08:40   0:31 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
Je ne comprends pas pourquoi la commande apparaît 4 fois ?
Merci
Bonjour,
Peux-tu faire un

Code : Tout sélectionner

ps -eaf
pour avoir les PPID (Parent ID) ?
austrasien
Membre
Membre
Messages : 28
Inscription : 25 sept. 2024, 12:13
Status : Hors-ligne

Le résultat de ps -eaf | grep christian2

Code : Tout sélectionner

christi+  544183  544179  2 22:37 pts/0    00:00:01 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
christi+  544184  544183  0 22:37 pts/0    00:00:00 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
christi+  544185  544184  3 22:37 pts/0    00:00:02 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
Avatar de l’utilisateur
zargos
Membre
Membre
Messages : 197
Inscription : 07 juil. 2023, 13:34
Status : Hors-ligne

austrasien a écrit : 11 déc. 2024, 22:42 Le résultat de ps -eaf | grep christian2

Code : Tout sélectionner

christi+  544183  544179  2 22:37 pts/0    00:00:01 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
christi+  544184  544183  0 22:37 pts/0    00:00:00 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
christi+  544185  544184  3 22:37 pts/0    00:00:02 rsync -av --delete-after --exclude-from=/home/christian2/exclus.txt /home/christian2 /media/christian2/Box/home
L'intéret aurait été de voir aussi le process correspondant au PPID 544184
Avatar de l’utilisateur
piratebab
Site Admin
Site Admin
Messages : 5852
Inscription : 24 avr. 2016, 18:41
Localisation : sud ouest
Status : En ligne

J'ai essayé de chercher si rsync ne lançait pas plusieurs process simultanément pour travailler en parallele, mais je n'ai rien trouver de probant sur le sujet. Pour le faire, il faut bidouiller, rien n'est prévu par défaut.
Alpha504
Membre
Membre
Messages : 32
Inscription : 01 oct. 2024, 07:22
Status : Hors-ligne

austrasien a écrit : 07 déc. 2024, 09:23 bonjour
J'ai placé cette commande de sauvegarde de mes données utilisateur dans anacrontab.

Code : Tout sélectionner

rsync -av --delete-after --exclude-from='/home/christian2/exclus.txt' /home/christian2 /media/christian2/Box/home
Tu as mis dans /etc/anacrontab quelque chose du genre:

Code : Tout sélectionner

1 0 backup rsync -av --delete-after --exclude-from='/home/christian2/exclus.txt' /home/christian2 /media/christian2/Box/home
Avec le "1" pour lancer la commande à un jour d'intervalle ?

D'après ce que j'ai lu sur internet, cron lance les tâches anacron pour daily, weely, et monthly. Ce qui pourrait expliquer pourquoi le rsync est lancé 3 fois.

Si tu as mis la ligne brute, sans préciser "1 0 backup" avant la commande, alors il se pourrait que la commande soit exécutée 3 fois par cron, et même plusieurs fois par jour au lieu d'une seule.

J'ai commencé un test sur mon pc, mais je ne sais pas quand cron va lancer la tâche anacron.
austrasien
Membre
Membre
Messages : 28
Inscription : 25 sept. 2024, 12:13
Status : Hors-ligne

Bonjour
Voici la copie intégrale de la commande placée dans anacrontab

Code : Tout sélectionner

1      30      sauvegarde      rsync -av --delete-after --exclude-from='/home/christian2/exclus.txt' /home/christian2 /media/christian2/Box/home
Moi aussi j'ai compris que le chiffre 1 indiquait chaque jour (période en jours puis délai en minutes)

J'ai réglé le problème autrement en plaçant la commande dans crontab éxécutée à 12h30, heure où je n'utilise pas la machine donc si elle est ralentie, ce n'est pas gênant.
Répondre