Yeah, I agree with Jim. I always put logic and pipes (except to devnull) into the script, usually in a folder called "/backups" ... :)
It allows me to test the scripts as well, or change the logic without modifying the crontab. Jon On 15 January 2015 at 07:04, Jim Klimov <[email protected]> wrote: > On 15 January 2015 03:01:56 CET, Harry Putnam <[email protected]> wrote: > >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. > > > > > > > > > > > > > > > > > >_______________________________________________ > >openindiana-discuss mailing list > >[email protected] > >http://openindiana.org/mailman/listinfo/openindiana-discuss > > It is in fact better to put all logic into separate scripts, at least from > systems management perspective - backup, reuse, versioning, comparison, > extension etc. are greatly simplified for separate files. > > I am also not sure if cron is generally required to pass requests through > a shell (rather than execute verbatim lines), and which one. You may have > better luck with double-quotes and backticks to substitute command output > rather than dollar-parenthesis though, e.g. "`date ...`" . > > HTH, Jim > -- > Typos courtesy of K-9 Mail on my Samsung Android > > _______________________________________________ > openindiana-discuss mailing list > [email protected] > http://openindiana.org/mailman/listinfo/openindiana-discuss > _______________________________________________ openindiana-discuss mailing list [email protected] http://openindiana.org/mailman/listinfo/openindiana-discuss
