[OpenIndiana-discuss] how to set variables in crontab

Harry Putnam reader at newsguy.com
Thu Jan 15 02:01:56 UTC 2015


WHen I try to set anything other than strict crontab entries cron
refuses my edited crontab.  Things like PATH or mailto, any kind of
var=value will cause it to be rejected.

The most recent error is apparently coming from trying to use the
date command like this

* * * * *  somecmd  > some-$(date +"%y%m%d_%H%M%%S").log

And apparently crontab is stumped on that and complains of unmatched `('

 sh: syntax error at line 1: `(' unmatched

Here is the actual line:
2  0,4,8,12,16,20 * * * ~/bin/rsnapshot -c /etc/rsnap/rc/rsnap_gvHome.conf hourly |tee /tmp/rsnap_gvHOME-$(date +\"%y%m%d_%H%M%S\").log

Of course I checked thinking that I had left one off, but I hadn't nor
is there a missing `"'

Its beginning to seem solaris cron is awfully strict.  Or maybe
primitive is the word.

Or maybe there is technique I'm lacking. That one is very likely 

`man crontab' says there are 3 variables supported.  Seems a bit
constricted eh?  I was supprised not to see `PATH' and `mailto' on the
list. 

There is always the option of putting whatever I want in a separate
wrapper script... but that seems like unecessary work.  At least to me.










More information about the openindiana-discuss mailing list