> On Feb 5, 2015, at 1:03 AM, Bob Proulx <b...@proulx.com> wrote: > > LuKreme wrote: >> The front actin simply calls sa-update. Do I just >> >> 16 1 * * * PATH=/usr/bin:/bin:/usr/local/bin /usr/local/bin/sa-update >> && /usr/local/bin/sa-compile && /usr/local/etc/rc.d/sa-spamd restart >> >> ? >> >> Or is there a reason not to do that? > > The syntax "variable=value command" is a /bin/sh syntax which sets the > variable for just that command. In the above sa-update would get the > PATH setting. But then && terminates that command.
I’m actually not positive that is the case. The && syntax chains the commands into a dependent chain (sa-update only triggers if sa-update succeeded and sa-spamd restart only triggers if both previous commands succeeded, so it would certainly make sense that some state like setting variables is preserver. Haven’t tested this, but it’s pretty trivial. # /bin/sh # PATH=/bin:/usr/local/bin echo $PATH && echo $PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin Hm. That’s odd. Something else going on there. > The next two commands sa-compile and sa-spamd would not get PATH set > differently for them. Is that important to you? No idea. I don’t know about the internals of sa-compile. I can’t think of any reason it could need gpg though. > # The default vixie-cron PATH is "/usr/bin:/bin", overriding the environment. > PATH="/usr/local/bin:/usr/bin:/bin:/usr/games” That does seem better (well, minus /usr/games) > Then PATH will be set for all commands started from that crontab. > > Personally I prefer to use a file /etc/cron.daily/spamassassin which > then calls all of the individual programs. The /etc/cron.daily is a > directory of scripts (not crontabs) where each script is run once > daily one after the other. Since that is a script you can set PATH in > that script and again it would be set for all subsequent invocations. That also sound good, but my crontab is actually quite simple. Sa-update, portsnap, and some deleting aging emails. -- 'I really should talk to him, sir. He's had a near-death experience!' 'We all do. It's called living.'