New-SshSession -ComputerName cagent01
$A= Invoke-SshCommand -InvokeOnAll -Quiet -Command '~/.bash_profile'
$B= Invoke-SshCommand -InvokeOnAll -Quiet -Command '~/.bashrc'
$Result = Invoke-SshCommand -InvokeOnAll -Quiet -Command './start'
$Ora = Invoke-SshCommand -InvokeOnAll -Quiet -Command 'echo $ORACLE_HOME'
write-host "Oracle home is $Ora"
Remove-SshSession -RemoveAll
i use PowerShell v3. This script isn't sourcing my .profile. I don't see $Ora printing any value.
When I manually log into the server to do echo $PATH, it includes the ORACLE path
echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/data/app/oracle/product/11.2.0/dbhome_1/bin:/home/HEALTHLANGUAGE/scmbuild/bin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc
The .bash_profile does export the PATH variable. export PATH
When I run a bamboo plan on this agent, it says ORACLE_HOME is not set. Manually loggin into the server sources the path correctly, but i want to do it using the script.
Can someone please help me with a work around? Or is it not possible to do this using PowerShell for Linux servers?
I sourced the /etc/profile in my .bashrc and incorporated that change to the new snapshot. It works like a charm now. Thank you so much for all the valuable inputs