- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2006 04:44 AM
12-11-2006 04:44 AM
Script
But my question is how can i export JAVA_HOME ; JBOSS_HOME in my script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2006 06:13 AM
12-11-2006 06:13 AM
Re: Script
export JAVA_HOME=/path_to/java/binaries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2006 08:04 PM
12-11-2006 08:04 PM
Re: Script
the SOlaris executable /usr/bin/sh is NOT the posix compliant shell - it is really the old Bourne Shell. So this syntax is invalid there:
export VAR=value
You have to use
VAR=value; export VAR
instead.
Using ksh or bash as interpreter will make the first construct valid.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 03:19 AM
12-12-2006 03:19 AM
Re: Script
hunki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 03:54 AM
12-12-2006 03:54 AM
Re: Script
check first the call of the correct interpreting shell in the first line of your script. It should be
#!/usr/bin/ksh
Please send an example of the failing assignment to a variable as well!
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 04:00 AM
12-12-2006 04:00 AM
Re: Script
#!/bin/ksh
do I need to change it to :
#!/usr/bin/ksh
thanks,
hunki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 04:01 AM
12-12-2006 04:01 AM
Re: Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 04:53 AM
12-12-2006 04:53 AM
Re: Script
you need not change this - Solaris has a compatibility link /bin -> /usr/bin
like HP-UX.
The solution is to change
export VAR=value
to
VAR=value; export VAR
Solaris will call your script at startup NOT via the interpreter in your file but with a hardcoded one NOT being able to parse your original statement.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 09:08 AM
12-12-2006 09:08 AM
Re: Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 09:41 AM
12-12-2006 09:41 AM
Re: Script
I use this script as :
jboss start
jboss stop
and I have 2 instances of jboss running here :
default & default2
I want the the script be modified so that I can specify individual instances of JBOSS and start or stop them like this :
jb start default
jb stop default
OR
jb start default2
jb stop default2
( default and default2 are mentioned in the script )
Can the script be modified to reflect this requirement while also keeping the startup /stop option open since its startup script. ( I mean $2 ( default etc ) shud be optional and shud not hamper while the jboss is restarted by the system after the reboot )
-----------------------
#!/bin/ksh
# File: jboss4.04.server
#
# Purpose: Start/Stop JBoss Application Server
#
# Parameter: start|stop|check
#
#
# Changes:
#
usage() {
echo "Usage: jboss start|stop" 1>&2
exit 1
}
#############main############
[ $# -ne 1 ] && usage
fct=$1
check_running(){
if [ `ps -u gtaq | grep java | grep -v grep | wc -l` -ne 0 ]; then
return 0
else
return 1
fi
}
### main ###
case "$fct" in
start)
check_running && echo "JBoss already running!" && exit 1
echo "Starting JBoss..."
su - gtaq -c "nohup /export/home/jack/jboss-4.0.4.GA/bin/run.sh -c default >/dev/null 2>/dev/null &"
su - gtaq -c "nohup /export/home/jack/jboss-4.0.4.GA/bin/run.sh -c default2_test >/dev/null 2>/dev/null &"
echo "Server startup may take a while - "
echo "check logfile /export/home/jack/jboss-4.0.4.GA/server/default/log/server.log for completion"
echo "check logfile /export/home/jack/jboss-4.0.4.GA/server/default2/log/server.log for completion"
;;
stop)
su - gtaq -c "/export/home/jack/jboss-4.0.4.GA/bin/shutdown.sh -S default"
su - gtaq -c "/export/home/jack/jboss-4.0.4.GA/bin/shutdown.sh -S -s jnp://localhost:1201"
;;
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 10:48 AM
12-12-2006 10:48 AM
Re: Script
>jb start default
>jb stop default
>OR
>jb start default2
>jb stop default2
Yes you can stop individual instances of the server by using a nested case statement for example:
case "$fct" in
start)
case $2 in
default)
echo "starting default jboss server"
;;
default2)
echo "starting default2 jboss server"
;;
"")
echo "starting all jboss servers..."
;;
*)
echo "invalid parameter...exiting"
exit
;;
esac
;;
stop)
case $2 in
default)
echo "stopping default jboss server"
;;
default2)
echo "stopping default2 jboss server"
;;
"")
echo "stopping all jboss servers..."
;;
*)
echo "invalid parameter...exiting"
exit
;;
esac
;;
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 10:57 AM
12-12-2006 10:57 AM
Re: Script
One more thing by putting in the nested case statements do I hamper the system's ability to start and stop jboss while a rebooting or shutting down the system because for the system there is not $2 here.
The $2 is for us while restarting JBOSS on the command line. Please correct me if I am wrong.
Thanks,
hunki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 11:26 AM
12-12-2006 11:26 AM
Re: Script
>The $2 is for us while restarting JBOSS on the command line. Please correct >me if I am wrong.
It will be okay during a reboot since the code below relies on $2 being empty:
"")
echo "starting all jboss servers..."
The above code is nested within the start and stop cases. So when the run-level scripts are being executed and there is no $2 parameter on the command line, it will enter the case mentioned above and either start or stop all the jboss servers (assuming you have a start all or stop all jboss servers script).
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2006 11:36 AM
12-12-2006 11:36 AM
Re: Script
> [ $# -ne 1 ] && usage
The above statement will cause commands like:
# jboss stop default
Or
# jboss start default
to error out
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2006 02:59 AM
12-19-2006 02:59 AM
Re: Script
I have two boxes on which I need to have this script and I want the same script to work on both boxes , how to achieve this within the case statement u earlier descirbed. Can u pls send me a layout of the case statements with the box names in it.
Thanks
hunki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2006 04:35 AM
12-19-2006 04:35 AM