cron issue

Adnane RABIH rabihadnane at gmail.com
Sun Mar 13 21:01:09 MDT 2011


Le 13/03/2011 23:45, Jan-Benedict Glaw a écrit :
> On Sun, 2011-03-13 21:30:58 +0000, Adnane RABIH<rabihadnane at gmail.com>  wrote:
>> Le 13/03/2011 18:10, Jan-Benedict Glaw a écrit :
>>> On Sun, 2011-03-13 16:10:12 +0000, Adnane RABIH<rabihadnane at gmail.com>   wrote:
>>>> I made a script to backup a folder on a remote server it works
>>>> manually, I set a cron job to launch the script every 2 mins (for
>>>> test), I sse in the log this line
>>>> Mar 13 13:10:01 debian /USR/SBIN/CRON[6302]: (root) CMD (root
>>>> /usr/bin/backup.sh)
>>>>
>>>> but when I sheck the remote server nothing is done, any sugestions pls
>>> Seems you forgot to attach the script you wrote.
>>>
>>> ...and when you send it, please also tell us as which user you call it
>>> and how your whole crontab looks like. (Some variables may be set there.)
>>>
>>> MfG, JBG
>>>
>> yep:) thanks for your help
>>
>> I found the script in a tutoriel and made some changes to it.
>>
>> the 2 machines are Debian boxes 6.0
>>
>> #crontab -e
>> # m h  dom mon dow   command
>> */5 * * * * root /usr/bin/backup.sh
> Here's a first problem.
>
> There's one system-wide crontab, as well as per-user crontabs. They
> slightly differ in their syntax. Per-user crontabs have an implicit
> owner, which must explicitely be set in the system-wide crontab. The
> syntax shown above contains a username (and thus is in system-wide
> syntax), but the system-wide crontab is never ever be changed by
> `crontab -e'.  So essentially, the command executed here is not
> "/usr/bin/backup.sh", but "root /usr/bin/backup.sh". And you probably
> should get emails with "command not found" or something like that,
> assuming that there's no "root" command on your machine.
>
>> # cat /etc/crontab
>> SHELL=/bin/sh
>> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>> # m h dom mon dow user    command
>> 17 *    * * *    root    cd /&&  run-parts --report /etc/cron.hourly
>> 25 6    * * *    root    test -x /usr/sbin/anacron || ( cd /&&
>> run-parts --report /etc/cron.daily )
>> 47 6    * * 7    root    test -x /usr/sbin/anacron || ( cd /&&
>> run-parts --report /etc/cron.weekly )
>> 52 6    1 * *    root    test -x /usr/sbin/anacron || ( cd /&&
>> run-parts --report /etc/cron.monthly )
>> #
> This is a correctly formatted system-wide crontab.
>
>> cron.log
>> Mar 13 17:10:01 debian /USR/SBIN/CRON[21083]: (root) CMD (root
>> /usr/bin/backup.sh)
> Obvious problem: an assumed per-user crontab is wrongly processed
> because it is in system-wide crontab format. Just throw out the word
> "root" in your per-user crontab file (to be modified by `crontab -e'),
> and your script will be executed.
>
> MfG, JBG

  yep I found 250 mail saying the same thing: root no such command :D, I 
throw it out and it works now, thanks.

Adnane



More information about the rsync mailing list