crontab question involving cvsup

Kevin D. Kinsey, DaleCo, S.P. kdk at daleco.biz
Thu Aug 26 08:28:22 PDT 2004


Joshua Tinnin wrote:

>On Thursday 26 August 2004 12:42 am, epilogue <epilogue at allstream.net> 
>wrote:
>  
>
>>On Thu, 26 Aug 2004 00:07:26 -0700
>>
>>Joshua Tinnin <krinklyfig at spymac.com> wrote:
>>    
>>
>>>OK, I have searched the archives, and I can't find that my question
>>>has been answered previously, but please forgive me if that's
>>>incorrect.
>>>
>>>I'm using (or rather trying to use) cron to update my ports tree
>>>daily. I've tried several different combinations without success,
>>>and lately this is what I have in my crontab file:
>>>
>>>/usr/local/bin/cvsup -g -L 2
>>>/home/krinklyfig/supfiles/ports-supfile && /usr/local/bin/portindex
>>>&& /usr/local/sbin/portsdb -u
>>>
>>>It runs as root once a day. What appears to be happening is that
>>>the cvsup is happening, but portindex is not, and because of the
>>>latter portsdb -u doesn't either. The reason I know cvsup is
>>>working is because portindex indicates that the ports tree has been
>>>updated if I run it manually later, but running portversion before
>>>manually running portindex will not indicate any changes. The cron
>>>log doesn't show anything but the commands being executed. So, my
>>>question is: is this type of command valid, or should each command
>>>be separate? Or is it not working for some other reason?
>>>      
>>>
>>man cron gives:
>>
>>crontab [-u user] file
>>
>>'file' being the important part, methinks.   ;)
>>    
>>
>
>I'm not sure what you mean ... If you're wondering, I'm using the main 
>crontab file (/etc/crontab), as right now there's no need for me to use 
>multiple ones.
>  
>

Just an aside, but a rather important one:  /etc/crontab is the *system*
crontab and shouldn't have your jobs in it.  It may in fact be this issue
that is causing the problem, but I've not looked into it enough to say
unequivocally...

Since your job needs root privileges, you should put this in root's
crontab, either by su'ing to root and running "crontab -e" at the prompt,
or if you have sudo installed, "sudo crontab -e" will get you there.

Unlike the system crontab, user crontabs, including root's, are
under /var/cron; the file format is slightly different, and misuse
of the system crontab for regular jobs is the cause of several
FAQ posts we see here every few months or so; one of these goes
something like, "why do I get an email from cron saying it can't
complete my job, unknown user, etc. ??"....

Kevin Kinsey
DaleCo, S.P.


More information about the freebsd-questions mailing list