in reply to Unable to see environment variable set

I want to mention a variation on this kind of unexpected- or unintuitive behaviour.

I remember once writing a script that would work either as a cgi or a cli script.
At some point what was driving me crazy, was that the thing seemed to respond different under the two environments.
A couple of things were happening. Albeit owned by 'username' was being run under 'apache' (since the server is making the call, without suexec) and the environment variables even under suexec may be different when run as cgi.

Another example of environment variable surprises.. This one was much more interesting.. cron. Your root crontab may be running scripts as nobody- or.. your /etc/crontab (if you keep it in a file) may be setting environment variables- like HOME to / instead of /root.

So, runnig a script via the cli and then doing the same thing out of a crontab, could yield different environments for the script.

  • Comment on Re: Unable to see environment variable set