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
10-11-2006 09:00 AM
10-11-2006 09:00 AM
Script
#! /bin/sh
start()
{
echo "Starting jboss.."
sudo -u com /home/tmp/cm/jboss-4.0.4.GA/bin/run.sh > /dev/null 2> /dev/null &
}
stop()
{
echo "Stopping jboss.."
sudo -u com /home/tmp/cm/jboss-4.0.4.GA/bin/shutdown.sh -S &
}
restart()
{
stop
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before we restart (warning this kills all Java instances running as 'com' user)
sudo -u com /usr/sbin/killall java
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 09:12 AM
10-11-2006 09:12 AM
Re: Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 09:19 AM
10-11-2006 09:19 AM
Re: Script
First off, you have a space between #! and /bin/sh
Try adding a set -x on second line and re running it.
I would add ' ' around the function names:
'start'()
{
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 06:34 PM
10-11-2006 06:34 PM
Re: Script
What error are u getting ,
You can execute the script with -x option and hopefully you can debug the problem.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 06:53 PM
10-11-2006 06:53 PM
Re: Script
be careful about the sematic of the killall-command. It IS different to the LINUX-Killall.
SEE killall(1M):
DESCRIPTION
killall is a procedure used by /usr/sbin/shutdown to kill all active processes not directly related to the shutdown procedure.
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 07:05 PM
10-11-2006 07:05 PM
Re: Script
additionally to the above comments have you tried:
sudo -u com -c "/home/tmp/cm/jboss-4.0.4.GA/bin/run.sh > /dev/null 2> /dev/null &"
you may need the -c option and quotes to get the redirection and background to work.
Also, change the function name stop as it may be a semi-reserved word.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2006 09:19 AM
10-12-2006 09:19 AM
Re: Script
set -x
#!/bin/sh
start()
{
echo "Starting jboss.."
sudo -u com "/export/home/tmp/cm/jboss-4.0.4.GA/bin/run.sh > /dev/null 2> /dev/null &"
}
stopjb()
{
echo "Stopping jboss.."
sudo -u com "/export/home/tmp/cm/jboss-4.0.4.GA/bin/shutdown.sh -S &"
}
restart()
{
stopjb
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before we restart (warning this kills all Java instances running as 'com' user)
#sudo -u com /usr/sbin/killall java
start
}
case "$1" in
start)
start
;;
stopjb)
stopjb
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stopjb|restart}"
exit 1
esac
exit 0
---------------
Here is the output I am getting :
>>./jboss restart
+ restart
Stopping jboss..
sudo: /home/tmp/cm/jboss-4.0.4.GA/bin/shutdown.sh -S &: command not found
>>./jboss start
+ start
Starting jboss..
sudo: /home/tmp/cm/jboss-4.0.4.GA/bin/run.sh > /dev/null 2> /dev/null &: command not found
+ exit 0
>>./jboss stopjb
+ stopjb
Stopping jboss..
sudo: /home/tmp/cm/jboss-4.0.4.GA/bin/shutdown.sh -S &: command not found
+ exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2006 09:28 AM
10-12-2006 09:28 AM
Re: Script
If sudo is in /usr/local/bin the do:
/usr/locall/bin/sudo -u com /home/tmp/cm/jboss-4.0.4.GA/bin/shutdown.sh -S &
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2006 03:53 AM
10-17-2006 03:53 AM
Re: Script
#!/bin/sh
start()
{
echo "Starting jboss.."
/usr/bin/su - com -c "/export/home/tmp/jboss-4.0.4.GA/bin/run.sh > /dev/null 2> /dev/null &"
}
stopjb()
{
echo "Stopping jboss.."
/usr/bin/su - aqgt -c "/export/home/tmp/jboss-4.0.4.GA/bin/shutdown.sh -S &"
}
restart()
{
stopjb
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before we restart (warning this kills all Java instances running as 'com' user)
#/usr/bin/su - com -c "/usr/bin/kill java"
start
}
case "$1" in
start)
start
;;
stopjb)
stopjb
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stopjb|restart}"
exit 1
esac
exit 0
Need to make the kill work in the restart function. Is there a way out .Also does the script looks workable apart from that.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2006 05:14 AM
10-17-2006 05:14 AM
Re: Script
#/usr/bin/su - com -c "/usr/bin/kill java"
to
/usr/bin/su - com -c "/usr/bin/kill java"