Looks like I'm late to the party. :-)

--- Amir
thumbed via iPhone

> On Oct 8, 2014, at 4:46 PM, Amir Caspi <ceph...@3phase.com> wrote:
> 
>> On Oct 8, 2014, at 4:23 PM, Duane Hill <duih...@gmail.com> wrote:
>> 
>> 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.
> 
> Unless I am mistaken, I believe this is not correct. On *nix systems, && is 
> the logical "and" operator, and it can be used to chain commands as 
> dependencies. && short-circuits on failure, so if the first command returns 
> zero, the "and" would fail and the second command never runs. The second 
> command is only evaluated if the first returns non-zero ("true"). Hence, 
> spamd is restarted only if sa-update actually loads an update, and not 
> otherwise.
> 
> This is the same reason why you can also see commands like:
> do_this || die
> in perl scripts, because the logical "or" operator || will short-circuit on 
> success, hence the "fallback" command never gets run if the first one 
> succeeded.
> 

Reply via email to