Re: [exim] How to rotate exim file using cron

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Heiko Schlittermann
Date:  
À: exim-users
Sujet: Re: [exim] How to rotate exim file using cron
Bobby Shahzad <ksj787@???> (Mi 03 Nov 2010 09:16:51 CET):
> Hello,
>
> I want to setup a cron to rotate exim file with a backup file every 7
> minutes. But the cp command doesnt seem to be working.
>
> I use
>
> 35    *    *    *    *    /bin/cp -f /etc/exim.conf6 /etc/exim.conf; service
> exim restart;
> 42    *    *    *    *    /bin/cp -f /etc/exim.conf7 /etc/exim.conf; service
> exim restart;

>


You (the crontab owner) should get mail if the above command creates some output. Iff your
mail system isn't that broken :-). The mail destination can be set using

    MAIL=other


in your crontab file. (At least vixie cron allows this.)


In absense of a working mail system you could try to save the output to
some file. Be sure that

    a) this file does not exist and that the directory
        is writable by the user the cron runs as. In /tmp normally this
        condition should be fullfilled.
or 


    b) the file is writable by the user cron runs as



35 * * * *    /bin/cp -f /etc/exim.conf6 /etc/exim.conf &>/tmp/log; service exim restart;


Or - if your shell (normally cron uses /bin/sh) doe'snt understand this,
you might use:

35 * * * *    /bin/cp -f /etc/exim.conf6 /etc/exim.conf >/tmp/log 2>&1; service exim restart;



Another note, for "cp" you're using the full path (why?), but for
"service" you rely on the shell finding it in your PATH. Normally
"service" is "/sbin/service", and normally the PATH in your crontab
environment doesn't include any *sbin* directory. This can be set, of
course.

If you're interested in the details, please refer to crontab(5).

--
Heiko :: dresden : linux : SCHLITTERMAN.de
GPG Key 48D0359B : 3061 CFBF 2D88 F034 E8D2 7E92 EE4E AC98 48D0 359B