Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Un Launch Daemon qui ne s'execute pas

2 réponses
Avatar
Vincent Lefevre
Bonjour,

J'ai le fichier /Library/LaunchDaemons/mail-cleanup.plist suivant:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">
<dict>
<key>Label</key>
<string>org.vinc17.mail-cleanup</string>
<key>UserName</key>
<string>vinc17</string>
<key>GroupName</key>
<string>vinc17</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>/usr/bin/find /Users/vinc17/Mail/backup -type f -mtime +15 -print0 | xargs -0 /bin/rm</string>
</array>
<key>ServiceDescription</key>
<string>Mail backup clean-up</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>6</integer>
<key>Minute</key>
<integer>17</integer>
</dict>
<key>LowPriorityIO</key>
<true/>
</dict>
</plist>

Le problème, c'est qu'il ne s'exécute pas. Pourtant un
"sudo launchctl list" indique bien org.vinc17.mail-cleanup
dans la liste, et dans /Library/LaunchDaemons, j'ai un
autre fichier du même genre, et quand je lance

sh -c '/usr/bin/find /Users/vinc17/Mail/backup -type f -mtime +15 -print0 | xargs -0 /bin/rm'

à la main, ça fonctionne.

Et /var/log/system.log n'indique rien de spécial (ni console.log).

D'où vient le problème?

Merci d'avance pour toute information.

--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

2 réponses

Avatar
Eric Levenez
Le 30/07/07 15:03, dans <20070730123452$, « Vincent
Lefevre » <vincent+ a écrit :

sh -c '/usr/bin/find /Users/vinc17/Mail/backup -type f -mtime +15 -print0 |
xargs -0 /bin/rm'


As-tu essayé /usr/bin/xargs au lieu de xargs ?

--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.

Avatar
Vincent Lefevre
Dans l'article <C2D4188D.AECBC%,
Eric Levenez écrit:

Le 30/07/07 15:03, dans <20070730123452$, « Vincent
Lefevre » <vincent+ a écrit :

sh -c '/usr/bin/find /Users/vinc17/Mail/backup -type f -mtime +15 -print0 |
xargs -0 /bin/rm'


As-tu essayé /usr/bin/xargs au lieu de xargs ?


Ah tiens, je l'avais oublié celui-là. Mais ça n'a rien changé.

J'ai finalement trouvé le problème: il faut faire

sudo launchctl unload /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons

(ou fournir uniquement le chemin vers le fichier .plist) pour que
launchd prenne les changements en compte. Rien n'est dit à ce propos
dans les pages man, et un "sudo kill -HUP 1" n'est pas suffisant.

--
Vincent Lefèvre - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)