Q:

What environment variables are available while starting the script using init.d boot process?

My problem is like this (OS is Sun Solaris):

At the boot time I want to start a process using a specific script. I am doing this by putting this script in /etc/init.d (and following other K and S rules).
The program which will be called by the script is located at $HOME/xxx/yyy location.
I am using 'su - {myuser} -c "{full path of the program}"' in order to execute the script as {myuser}.
I don't want to hardcode the value of $HOME in the script, but I want to use the $HOME environment variable only. How can I get this $HOME environment variable in the shell script? Also what other variables will be available to me?

A:

To get the home variable of any user, try this hack:
HOME=`sudo -u myuser -s "cd ~; pwd"`

