On Wednesday, October 8, 2014, 3:11:06 PM, LuKreme wrote:

>> On 08 Oct 2014, at 04:56 , Duane Hill <duih...@gmail.com> wrote:
>> 
>> On Tuesday, October 7, 2014, 10:56:54 PM, LuKreme wrote:
>> 
>>> On 07 Oct 2014, at 11:45 , Jari Fredrisson <ja...@iki.fi> wrote:
>>>> I ran sa-update & sa-compile.
>> 
>>> Should sa-compile be run after sa-update?
>> 
>>> I have a crontab entry:
>> 
>>> 16  1  *  *  *  /usr/local/bin/sa-update &&
>>> /usr/local/etc/rc.d/sa-spamd restart
>> 
>>> should I add an sa-compile call?
>> 
>> I am on FreeBSD here. This is what I use:
>> 
>> Content of sa_update.sh:
>> 
>>  #!/bin/sh
>> 
>>  /usr/local/bin/sa-update -D --nogpg
>> 
>>  if [ $? -eq 0 ] ; then
>>  /usr/local/bin/sa-compile
>>  /usr/local/etc/rc.d/sa-spamd restart
>>  exit 0
>>  else
>>  exit 0
>>  fi
>> 
>> This  way, sa-compile is ran and spamd is restarted only when there is
>> an update. I then use the script in a cron which runs once per day.
>> 
>> I  believe  the  way  you have it, spamd will get restarted every time
>> your cron is ran whether there is an update or not.

> It will get restarted if the sa-update process finishes cleanly
> (that’s what && does) which I think is the same as if [ $? -eq 0];

> So, I’ll add an sa-compile in there, thanks.

No.  &&  is  a  way  of chaining commands together. Your cron says run
sa-update  and  then  restart  spamd.  In  other words, when sa-update
finishes  running,  regardless  if there was an update applied or not,
restart spamd.

The  part  in my shell script you mentioned '[ $? -eq 0]' tests to see
if  the  exit result of running sa-update is not equal to zero. If the
result  is  not  equal  to  zero,  meaning  an  update was loaded, run
sa-compile and restart spamd.

-- 
Duane Hill
duih...@gmail.com
"If at first you don't succeed, so much for sky diving."

Reply via email to