unable to set env variables in a script
Hello,
I am struggling with this script which I have to create to startup app database at reboot. Now the problem is before running the command to start the database I am suppose to set some environment variable for the system. This is the file which contains all the env variable and manually I run using this command Code:
# . tux.env Code:
# less tux.env Code:
# psadmin -p start -d fin91dmo Code:
# less app.sh Code:
psadmin command not found Am I doing any thing wrong as I am not so good with scripts. Is there any way I can automate this process? |
try
Code:
/path/to/psadmin -p start -d fin91dmo |
or try set -xv at the beginning of the script (as second line)
|
Do what Habitual says about paths to executables, always code with the known path name.
Notice how you defined TUX_DIR within your script, that's also something you can do. However if you run the tux.env and export variables you should be able to import those variables in your script using "import VAR" |
another option :: alter path
Another option would be to alter the PATH defined in tux.env to ensure the psadmin executable is on the path.
If you find that is not working, echo $PATH before the command is executed to make sure the path is set as you expect. It is possible another script alters the path. |
Quote:
So I decided to put the path of those variables in my .bash_profile and it is working. Now when I start my machine the database gets up without any problem but the problem starts when we login to that user using putty or and client software the .bash_profile script runs again leading to run those commands for starting database :D Well I knew about this consequence before using .bash_profile for setting up environment variable. I tried to manually assign those variables in my script but I do not understand why it does not works. Code:
# vi app.sh Quote:
|
you can use this way:
Code:
#!/bin/bash bash -xv <your script> this will produce an output about the running script and you will see what was happening. |
All times are GMT -5. The time now is 12:29 AM. |