[opensuse] Re: how to set global environment variables in crontabs
Anton Aylward wrote:
Joachim Schrod said the following on 11/23/2012 10:49 AM:
I use Perl to test that the env var is set for all cron jobs and not just for shell scripts.
If you used the 'env' command you'd see a lot more and that _might_ give a clue.
What clue _might_ I need? My posted scripts work. I tested them. Meike is right that $ENV is not sourced -- which is strange, but I didn't investigate. After she told that in her email, I wrote the scripts and tested it. (Before, I only relayed info from documentation.) My test result: $BASH_ENV is sourced when SHELL is set to /bin/bash; so she can use that. IMNSHO: One doesn't need any additional clue, output by the command env, here. I'm not interested in other env vars. I'm just interested in the one that is set in the to-be-sourced /tmp/setenv.sh. I also don't need to test that $ENV or $BASH_ENV are set, I use env vars in crontab all the time and that Just Works(tm), no need to check that again. I also don't want an entry like * * * * * env which would send email every minute. Instead I want it in a file where I can use F in less. In addition, IMO, just one line added there is better than a whole bunch of lines; one sees differences to previous invocations faster. Humans are excellent pattern matchers line-by-line, but not so block-by-block. I.e., I think my Perl script is also better than "env >>/tmp/foo.out". Maybe adding a timestamp to that one line would be helpful, and even for that the Perl script is better again, just add localtime() to the print statement. Just my 0.02 EUR, Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jschrod@acm.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Joachim Schrod said the following on 11/23/2012 12:33 PM:
Anton Aylward wrote:
Joachim Schrod said the following on 11/23/2012 10:49 AM:
I use Perl to test that the env var is set for all cron jobs and not just for shell scripts.
If you used the 'env' command you'd see a lot more and that _might_ give a clue.
What clue _might_ I need? My posted scripts work. I tested them.
Meike is right that $ENV is not sourced -- which is strange, but I didn't investigate. [....]
I also don't want an entry like * * * * * env
Ah, we're talking at cross purposes then! I was thinking in terms of experimenting - seeing what _could_ be put in the environment and what ended up in there that you didn't explicitly put there, varying conditions, different shells, entries in /etc/passwd and so forth. And yes, I did that I found that it does vary things. You seem to be jumping straight to 'production'. Fair enough. This wasn't as critical for me as for you; I had the time to experiment ... -- "...there is no reason anyone would want a computer in their home." Ken Olson, President, Chairman, and Founder of DEC, 1977 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Anton Aylward
-
Joachim Schrod