Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
This is for Red Hat Enterprise Linux running bash 3.2.25(1).
I created a .sh file to collect thread statistics for the application that the server was built for. The shell file is supposed to read the value of one key environment variable, $HCIROOT, at the beginning; it isn't, so the value of all derived vars are missing what should be there. The remainder of the shell script runs as it should, but without accomplishing anything.
The script file references the environment var using $<varname>, which I saw in another job file that runs fine every night. Is there another method that I should be using?
The HCIROOT environment var is set when the server is booted (once per year), so what do I need to do get the shell script to use it?
This is a dedicated interface engine server, so the HCIROOT var should be set at server startup, based on the server startup file. The var does appear when I type env or set.
There is also a .profile in the /home/hci directory, which I assume is run whenever I log in as hci. The HCIROOT var is not set there.
That would be in a different process env to cron job.
If you want it avail to other processes, it needs to be set eg in /etc/profile, or maybe even in a file.
Each process runs in its own env in *nix; there's no 'global' env as such, although you can 'export' vars down a process tree.
See various references to 'export' here http://linux.die.net/man/1/bash
was a mass quantity of "Permission denied" and "No such device or address" restrictions on every file that grep tried to search.
The result of
Code:
grep -r HCIROOT ~/.[A-z]*
was a list of references to HCIROOT in the .bash_history file. The birth of this variable is quite the mystery.
Reading theNbomr's statement about the common idiom in Linux gave me the idea to source the .profile from within my getstats2.sh script, instead of sourcing it in the crontab file. Both files are in /home/hci, at least for now. I also decided to manually create the HCIROOT var since, on this engine product, the var is always set to
Code:
$CL_INSTALL_DIR/integrator
and the CL_INSTALL_DIR var is set in /home/hci/.profile.
Let me know what you think. And thanks for all your suggestions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.