On Tue, Sep 16, 2008 at 09:08:24PM +0200, David BERCOT wrote: > Dans un script lancé en tant que root, je souhaiterais créer une tâche > pour un utilisateur lambda. > > J'ai tenté un truc du genre (dans mon script) : > su mon_user > crontab -l > fichier_crontab > echo "40 20 * * * /home/mon_user/script" >> fichier_crontab > crontab fichier_crontab > rm fichier_crontab > exit > > Mais en fait, ça me rajoute la tâche au niveau du root et le 'exit' > ne fait pas ce que je veux (ça, c'est moins gênant ;-))) !!! > > Auriez-vous une petite idée ?
man crontab option -u (associer -l) le "su mon_user" au milieu du script ne marchera jamais (en fait, si : il bloque le script au niveau du "su", qui appelle un nouveau shell), on utilise systématiquement en mode non-interactif "su -c commande". exit sort du shell courant note que tu peux faire un (presque) uniligne avec un pipe sed au milieu : commande1 | sed -e "$ a \ blah blah" | commande2 -- === The BOFH Excuse Server === Your excuse is: Out of cards on drive D: -- Lisez la FAQ de la liste avant de poser une question : http://wiki.debian.org/DebFrFrenchLists Vous pouvez aussi ajouter le mot ``spam'' dans vos champs "From" et "Reply-To:" To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

