LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Execution of a script -Urgent help needed?? (https://www.linuxquestions.org/questions/linux-software-2/execution-of-a-script-urgent-help-needed-767138/)

anish2343 11-05-2009 02:48 PM

Execution of a script -Urgent help needed??
 
I have installed Apache in my Linux5.1 machine.I have root access in that.I have also installed siteminder in that.Now everytime when i restart the apache its unable to load a env file from siteminder.Then i need to execute a script seperatly.What i need is to execute a script ". ./nete_wa_env.sh" evrytime when i login as "root"


Can somebody help me on it...

velomoose 11-05-2009 03:26 PM

When you login, a .bashrc or a profile style .bashrc file is called in the default bash shell. If your shell script sets up environment variables, you can add these to the root profile for startup. This is typically located in the /root/.bashrc file or you may try adding the shell script to the /etc/profile.d/ directory.

TB0ne 11-05-2009 03:27 PM

Quote:

Originally Posted by anish2343 (Post 3746130)
I have installed Apache in my Linux5.1 machine.I have root access in that.I have also installed siteminder in that.Now everytime when i restart the apache its unable to load a env file from siteminder.Then i need to execute a script seperatly.What i need is to execute a script ". ./nete_wa_env.sh" evrytime when i login as "root"

Can somebody help me on it...

If you really want to, put it in root's .profile (or .bashrc), so it'll execute everytime you log in. Bad idea, though, since if you log it twice or more per day as root, you'll keep running multiple copies.

A better thing to do, would be to put it at the bottom of the apache startup script, so it'll run whenever Apache is restarted....

anish2343 11-05-2009 03:42 PM

Is it advisable to have a wrapper scrip which call my env file along with the startup script of apache.If so can you please give me the syntax or command to create one...

TB0ne 11-06-2009 08:24 AM

Quote:

Originally Posted by anish2343 (Post 3746188)
Is it advisable to have a wrapper scrip which call my env file along with the startup script of apache.If so can you please give me the syntax or command to create one...

No idea what you're asking for, in terms of a "wrapper scrip which call my env file".

In your first post, you said you already HAVE a shell script, that needs to be run, after you start up Apache. As I suggested, why don't you just put that same script file, in the Apache startup script???? Open the /etc/init.d/apache2 file, find the start routine, and put a call in there to run your shell script. That's it.


All times are GMT -5. The time now is 01:24 AM.