BILL Carlisle
asked on
What is the converted result of this Bash script to sh for Solaris 10?
What is the converted result of this Bash script to #!/sbin/sh for Solaris 10?
set JAVA_HOME=/u00/app/jdk1.7.0_45
set AS_JAVA=/u00/app/jdk1.7.0_45
set JAVA_BINDIR="${JAVA_HOME}/bin"
echo "Set PATH with Java"
echo $PATH | /bin/grep -v "${JAVA_BINDIR}"
if ( $status == 0 ) then
setenv PATH "${JAVA_BINDIR}:${PATH}"
endif
GLASSFISH=/u00/app/oracle/product/glassfish4
DERBY_BIN=/u00/app/oracle/product/glassfish4/javadb/bin
case "$1" in
‘start’)
echo "Starting GlassFish from $GLASSFISH" > /tmp/GlassFishStarted.txt
/bin/su glassfish "$GLASSFISH/bin/asadmin" start-database
/bin/su glassfish "$GLASSFISH/bin/asadmin" start-domain appsand01
;;
stop)
echo "Stopping GlassFish from $GLASSFISH"
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" stop-domain appsand01
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" stop-database
;;
restart)
$0 stop
$0 start
;;
status)
echo "# GlassFish at $GLASSFISH:"
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" list-domains | grep -v Command
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" list-domains | grep -q "appsand01 running"
if [ $? -eq 0 ]; then
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" uptime | grep -v Command
echo "\n# Deployed applications:"
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" list-applications --long=true --resources | grep -v Command
echo "\n# JDBC resources:"
sudo -u glassfish -E "$GLASSFISH/bin/asadmin" list-jdbc-resources | grep "jdbc/"
fi
echo "\n# Derby:"
sudo -u glassfish -E "$DERBY_BIN/NetworkServerControl" ping | sed "s/^.* : //"
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
could you edit the answers and remove my headed information - name, company etc
thank you..
thank you..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great it compiles... but something is not working
Can't I just su - glassfsh once somehow ?
OUTPUT from above:
All this is from one su - glassfsh
Can't I just su - glassfsh once somehow ?
status)
echo '# GlassFish at "$GLASSFISH:"'
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-domains | grep -v Command
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-domains | /usr/xpg4/bin/grep -q "appsand01 running"
if [ $? -eq 0 ]; then
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" uptime | grep -v Command
echo '\n# Deployed applications:'
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-applications --long=true --resources | /usr/xpg4/bin/grep -v Command
echo '\n# JDBC resources:'
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-jdbc-resources | grep "jdbc/"
fi
echo '\n# Derby:'
/bin/su - glassfsh -c "$DERBY_BIN/NetworkServerControl" ping | sed "s/^.* : //"
;;
*)
echo 'Usage: $0 {start|stop|restart|status}'
exit 1
;;
OUTPUT from above:
# GlassFish at /u00/app/oracle/product/glassfish4
Oracle Corporation SunOS 5.10 Generic Patch January 2005
Set path shell variable
Set PATH with Java
/usr/bin:
Set GlassFish Environment
/u00/app/jdk1.7.0_45/bin:/usr/bin:
Set Environment
Shortcut aliases
Use "exit" to exit and "help" for online help.
All this is from one su - glassfsh
Oracle Corporation SunOS 5.10 Generic Patch January 2005
Set path shell variable
Set PATH with Java
/usr/bin:
Set GlassFish Environment
/u00/app/jdk1.7.0_45/bin:/usr/bin:
Set Environment
Shortcut aliases
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What is happening is
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-domains | grep -v Command
it is getting hung on if [ $? -eq 0 ]; then ??
Actually how whould I write:
Where asadmin is a command prompt and just want to pipe the commands into the existing prompt? :)
This
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin"
gives this
asadmin>
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-domains | grep -v Command
it is getting hung on if [ $? -eq 0 ]; then ??
Actually how whould I write:
status)
echo '# GlassFish at "$GLASSFISH:"'
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin"
< list-domains | grep -v Command
< list-domains | /usr/xpg4/bin/grep -q "appsand01 running"
if [ $? -eq 0 ]; then
< uptime | grep -v Command
echo '\n# Deployed applications:'
< list-applications --long=true --resources | /usr/xpg4/bin/grep -v Command
echo '\n# JDBC resources:'
< list-jdbc-resources | grep "jdbc/"
fi
echo '\n# Derby:'
/bin/su - glassfsh -c "$DERBY_BIN/NetworkServerControl" ping | sed "s/^.* : //"
;;
*)
echo 'Usage: $0 {start|stop|restart|status}'
exit 1
;;
Where asadmin is a command prompt and just want to pipe the commands into the existing prompt? :)
This
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin"
gives this
asadmin>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you..
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-domains | grep -v Command
I placed list-domains | grep -v Command in the quotes to make all one command
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin list-domains | grep -v Command"
otherwise it was stopping at
Oracle Corporation SunOS 5.10 Generic Patch January 2005
Set path shell variable
Set PATH with Java
/usr/bin:
Set GlassFish Environment
/u00/app/jdk1.7.0_45/bin:/ usr/bin:
Set Environment
Shortcut aliases
Use "exit" to exit and "help" for online help.
asadmin>
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin" list-domains | grep -v Command
I placed list-domains | grep -v Command in the quotes to make all one command
/bin/su - glassfsh -c "$GLASSFISH/bin/asadmin list-domains | grep -v Command"
otherwise it was stopping at
Oracle Corporation SunOS 5.10 Generic Patch January 2005
Set path shell variable
Set PATH with Java
/usr/bin:
Set GlassFish Environment
/u00/app/jdk1.7.0_45/bin:/
Set Environment
Shortcut aliases
Use "exit" to exit and "help" for online help.
asadmin>
ASKER
Thank you very much for your help, I will tweak it tomorrow.
>> I placed list-domains | grep -v Command in the quotes to make all one command <<
That's indeed what I suggested - see ID: 39697065 above!
That's indeed what I suggested - see ID: 39697065 above!
ASKER
this is what I am getting from the output
Open in new window