# Cron.daily ne démarre plus les scripts

**URL:** <https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351>\
**Category:** Support Debian\
**Created:** [Janvier 8, 2019, 3:59 UTC](https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351 "2019-01-08T15:59:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruggero1963](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/r/e8c25b/32.png) [@Ruggero1963](https://www.debian-fr.org/u/Ruggero1963)\
**Post date:** [Janvier 8, 2019, 3:59 UTC](https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351/1 "2019-01-08T15:59:13Z")

</div>

Bonjour,  
Je suis sur une distrib Jessie LTSP  
Je ne comprends pas pourquoi les scripts de cron.daily ne démarrent plus.  
Lorsque je les lance manuellement :

_ **/etc/cron.daily/./integrit** _  
_ **/etc/cron.daily/./00logwatch** _

etc …  
Pas de problème mais sinon rien je ne reçois pas les mails de confirmation.  
D’autre part logrotate ne fonctionne plus non plus, javais un syslog sur plus de 2 mois de 368 Mb  
Seul indice que j’ai trouvé dans les logs :

**_grep cron /var/log/syslog_**

```nohighlight
CRON[15047]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
CRON[17574]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
CRON[2238]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
CRON[6403]: (root) CMD (test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null)
systemd[1]: Started Run anacron jobs.
CRON[24833]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)

```

Auriez-vous une idée d’où peurt venir le problème ??  
Merci beaucoup par avance

---

<div class="post-metadata">

**Author:** ![grandtoubab](https://www.debian-fr.org/user_avatar/www.debian-fr.org/grandtoubab/32/4505_2.png) [@grandtoubab](https://www.debian-fr.org/u/grandtoubab)\
**Post date:** [Janvier 8, 2019, 6:23 UTC](https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351/2 "2019-01-08T18:23:25Z")

</div>

Salut  
anacron ne fonctionne que si l’alimentation sur secteur est branchée **ConditionACPower=true**  
Cf le service:

```auto
cat /lib/systemd/system/anacron.service
[Unit]
Description=Run anacron jobs
After=time-sync.target
# By default, anacron will not run when no AC power is connected to system.
# If you are using systemd and want to run anacron even when running on
# battery, you should create the following file with the specified content
# and then call "systemctl daemon-reload":
# /etc/systemd/system/anacron.service.d/on-ac.conf:
# [Unit]
# ConditionACPower=
# See /usr/share/doc/anacron/README.Debian for detailed information.
ConditionACPower=true
Documentation=man:anacron man:anacrontab

[Service]
EnvironmentFile=/etc/default/anacron
ExecStart=/usr/sbin/anacron -d -q $ANACRON_ARGS
IgnoreSIGPIPE=false
KillMode=mixed
# Use SIGUSR1 to stop gracefully
KillSignal=SIGUSR1

[Install]
WantedBy=multi-user.target

```

pour vérifier l’horodatage du dernier lancement

```auto
cd /var/spool/anacron/

/var/spool/anacron$ ls -alrt
total 24
drwxr-xr-x 8 root root 4096 mai 25 2016 ..
drwxr-xr-x 2 root root 4096 oct. 21 10:13 .
-rw------- 1 root root 9 déc. 27 10:14 cron.monthly
-rw------- 1 root root 9 janv. 8 11:55 cron.daily
-rw------- 1 root root 9 janv. 8 12:05 cron.weekly
-rw------- 1 root root 9 janv. 8 20:14 cron.hourly

```

---

<div class="post-metadata">

**Author:** ![Ruggero1963](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/r/e8c25b/32.png) [@Ruggero1963](https://www.debian-fr.org/u/Ruggero1963)\
**Post date:** [Janvier 9, 2019, 10:48 UTC](https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351/3 "2019-01-09T10:48:47Z")

</div>

> [@grandtoubab](#):
>
> cd /var/spool/anacron/

Salut et merci de ta réponse.  
Je pense qu’il y a une autre souci, en effet voici les réponses aux 2 commandes suivantes :

**_cat /lib/systemd/system/anacron.service_**

```plaintext
[Unit]
Description=Run anacron jobs
After=time-sync.target
ConditionACPower=true

[Service]
ExecStart=/usr/sbin/anacron -dsq
IgnoreSIGPIPE=false

[Install]
WantedBy=multi-user.target

```

**_cd /var/spool/anacron/_**

```plaintext
-rw------- 1 root root 9 déc 7 17:20 cron.daily
-rw------- 1 root root 9 oct 25 07:45 cron.monthly
-rw------- 1 root root 9 nov 7 07:40 cron.weekly

```

Ca remonte à décembre, novembre et octobre dernier !?!

---

<div class="post-metadata">

**Author:** ![Ruggero1963](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/r/e8c25b/32.png) [@Ruggero1963](https://www.debian-fr.org/u/Ruggero1963)\
**Post date:** [Janvier 9, 2019, 10:55 UTC](https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351/4 "2019-01-09T10:55:47Z")

</div>

J’ai réinstallé cron et anacron voici le compte rendu :

```nohighlight
[root@grenadier:/]#aptitude reinstall cron anacron
Les paquets suivants seront RÉINSTALLÉS :               
  anacron cron 
0 paquets mis à jour, 0 nouvellement installés, 2 réinstallés, 0 à enlever et 47 non mis à jour.
Il est nécessaire de télécharger 127 ko d'archives. Après dépaquetage, 0 o seront utilisés.
Prendre : 1 http://ftp.ch.debian.org/debian/ jessie/main cron amd64 3.0pl1-127+deb8u1 [94.0 kB]
Prendre : 2 http://ftp.ch.debian.org/debian/ jessie/main anacron amd64 2.3-23 [32.8 kB]
 127 ko téléchargés en 0s (978 ko/s)
(Lecture de la base de données... 170257 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../cron_3.0pl1-127+deb8u1_amd64.deb ...
Dépaquetage de cron (3.0pl1-127+deb8u1) sur (3.0pl1-127+deb8u1) ...
Préparation du dépaquetage de .../anacron_2.3-23_amd64.deb ...
Dépaquetage de anacron (2.3-23) sur (2.3-23) ...
Traitement des actions différées (« triggers ») pour systemd (215-17+deb8u8) ...
Traitement des actions différées (« triggers ») pour man-db (2.7.0.2-5) ...
Paramétrage de cron (3.0pl1-127+deb8u1) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Paramétrage de anacron (2.3-23) ...

```

Que signifie le message de l’avant dernière ligne concernant update-rc.d ??  
Encore merci. 🤔😃

---

<div class="post-metadata">

**Author:** ![grandtoubab](https://www.debian-fr.org/user_avatar/www.debian-fr.org/grandtoubab/32/4505_2.png) [@grandtoubab](https://www.debian-fr.org/u/grandtoubab)\
**Post date:** [Janvier 9, 2019, 11:00 UTC](https://www.debian-fr.org/t/cron-daily-ne-demarre-plus-les-scripts/78351/5 "2019-01-09T11:00:05Z")

</div>

> [@Ruggero1963](#):
>
> Salut et merci de ta réponse.  
> Je pense qu’il y a une autre souci, en effet voici les réponses aux 2 commandes suivantes :
> 
> **_cat /lib/systemd/system/anacron.service_**
> 
> ```plaintext
> [Unit]
> Description=Run anacron jobs
> After=time-sync.target
> ConditionACPower=true
> 
> [Service]
> ExecStart=/usr/sbin/anacron -dsq
> IgnoreSIGPIPE=false
> 
> [Install]
> WantedBy=multi-user.target
> 
> ```
> 
> **_cd /var/spool/anacron/_**
> 
> ```plaintext
> -rw------- 1 root root 9 déc 7 17:20 cron.daily
> -rw------- 1 root root 9 oct 25 07:45 cron.monthly
> -rw------- 1 root root 9 nov 7 07:40 cron.weekly
> 
> ```
> 
> Ca remonte à décembre, novembre et octobre dernier !?!

Le code n’est pas identique dans ta Jessie, je suis en Buster

```auto
apt list --installed | grep cron

anacron/testing,unstable,now 2.3-27 amd64 [installé]
cron/testing,unstable,now 3.0pl1-130 amd64 [installé]

```

Et oui les dates sont celles des derniers lancement par anacron  
Exemple sur mon **PC**

`journalctl -xb | grep cron`

```auto
janv. 09 10:46:18 debian systemd[1]: Started Trigger anacron every hour.
-- Subject: L'unité (unit) anacron.timer a terminé son démarrage
-- L'unité (unit) anacron.timer a terminé son démarrage, avec le résultat done.
janv. 09 10:46:18 debian systemd[1]: Started Run anacron jobs.
-- Subject: L'unité (unit) anacron.service a terminé son démarrage
-- L'unité (unit) anacron.service a terminé son démarrage, avec le résultat done.
janv. 09 10:46:18 debian anacron[2089]: Anacron 2.3 started on 2019-01-09
janv. 09 10:46:19 debian anacron[2089]: Will run job `cron.hourly' in 40 min.
janv. 09 10:46:19 debian anacron[2089]: Jobs will be executed sequentially
janv. 09 11:26:18 debian anacron[2089]: Job `cron.hourly' started
janv. 09 11:26:18 debian anacron[8545]: Updated timestamp for job `cron.hourly' to 2019-01-09
janv. 09 11:26:43 debian anacron[2089]: Job `cron.hourly' terminated
janv. 09 11:26:43 debian anacron[2089]: Normal exit (1 job run)
janv. 09 11:26:43 debian systemd[1]: anacron.service: Succeeded.
-- The unit anacron.service has successfully entered the 'dead' state.
janv. 09 11:31:58 debian systemd[1]: Started Run anacron jobs.
-- Subject: L'unité (unit) anacron.service a terminé son démarrage
-- L'unité (unit) anacron.service a terminé son démarrage, avec le résultat done.
janv. 09 11:31:58 debian anacron[8690]: Anacron 2.3 started on 2019-01-09
janv. 09 11:31:58 debian anacron[8690]: Will run job `cron.hourly' in 40 min.
janv. 09 11:31:58 debian anacron[8690]: Jobs will be executed sequentially

```

Comme ce n’est pas le premier boot, il ne relance pas les daily mais c’est normal, il a été lance au premier boot

```auto
ls -alrt /var/spool/anacron/
total 24
drwxr-xr-x 8 root root 4096 mai 25 2016 ..
drwxr-xr-x 2 root root 4096 oct. 21 10:13 .
-rw------- 1 root root 9 déc. 27 10:14 cron.monthly
-rw------- 1 root root 9 janv. 8 12:05 cron.weekly
-rw------- 1 root root 9 janv. 9 08:34 cron.daily
-rw------- 1 root root 9 janv. 9 11:26 cron.hourly

```

ça ne nous dit pas si la condition **branché sur secteur** est vraie chez toi

mon petit mémo sur la question, je ne sais rien de plus

> **[Anacron, c’est pas une insulte.](https://bidouilledebian.wordpress.com/2018/06/02/anacron-cest-pas-une-insulte/)**
>
> Pour lancer des tâches périodiques, de maintenance  ou autres, rien de mieux que Anacron
