Copy the following script to /etc/init.d/webpshere_portal or some name.
#!/bin/bash
# Websphere_portal # Startup script for IBM WebSphere Portal Server
#
# chkconfig: - 99 15
# description: Websphere Portal server startup
# processname: websphere_portal
# pidfile: /var/run/websphere_portal.pid
# author: Nabeel Moidu nabeelmoidu.at.gmail dot com
# Source function library.
. /etc/rc.d/init.d/functions
portal=/opt/IBM/PE/AppServer/profiles/wp_profile/bin
args=WebSphere_Portal
prog="WebSphere Portal Server"
proc=/opt/IBM/WebSphere/AppServer/java/bin/java
RETVAL=0
username=portaluser
password=password
# verify installation
if [ ! -x $portal ]; then
echo "$prog is not installed"
exit 0
fi
# source function library
. /etc/rc.d/init.d/functions
case "$1" in
start)
# Websphere should come up only if DB2 is up.
for (( ; ; ))
do
# Check status of DB2
su - wpdb2ins -c 'db2gcf -s' | grep Available;
PRC_EXT_STAT=$?;
# If DB2 is available, then startup the portal
if [ $PRC_EXT_STAT = "0" ]; then
echo -n "Starting $prog: "
# Set ulimit
ulimit -n 1000000
# setup environment variables
. /home/wpdb2ins/sqllib/db2profile
# Bring up the portal
$portal/startServer.sh $args
RETVAL=$?
if [ $RETVAL = 0 ]; then
touch /var/lock/subsys/websphere_portal
echo_success
else
echo_failure
fi
break;
# If DB2 is not up, then start DB2
else
su - wpdb2ins -c 'db2start'
fi
done
;;
stop)
echo -n "Shutting down $prog: "
$portal/stopServer.sh $args -username $username -password $password
RETVAL=$?
if [ $RETVAL = 0 ]; then
rm -f /var/lock/subsys/websphere_portal
# Shut down DB2
su - wpdb2ins -c 'db2stop';
echo_success
else
echo_failure
fi
echo
;;
restart)
$0 stop
$0 start
;;
status)
status $proc
;;
*)
echo "Usage: websphered {start|stop|restart|status}"
exit 1
esac
exit 0
Then execute the following commands
chmod +x /etc/init.d/websphere_portal
chkconfig --add /etc/init.d/websphere_portal
chkconfig --level 345 websphere_portal on
LINK ---> http://nmkuttiady.blogspot.com/2009/07/init-script-for-websphere-portaldb2-on.html
Thursday, July 23, 2009
Websphere startup script for linux
Startup script for Websphere Application server on linux. Its got an added check for Oracle connectivity before the service is brought up.
#!/bin/bash
# Websphered # Startup script for IBM WebSphere Application Server
#
# chkconfig: - 99 15
# description: IBM's J2EE application server
# processname: websphered
# pidfile: /var/run/websphered.pid
# Source function library.
. /etc/rc.d/init.d/functions
websphered=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
args=server1
prog="WebSphere Application Server"
proc=/opt/IBM/WebSphere/AppServer/java/bin/java
RETVAL=0
username=user
password=password
# verify installation
if [ ! -x $websphered ]; then
echo "$prog is not installed"
exit 0
fi
# source function library
. /etc/rc.d/init.d/functions
case "$1" in
start)
# Continous loop to check Oracle connectivity. Websphere should come up only if Oracle is up.
for (( ; ; ))
do
# Check for Oracle connectivity
su - oracle -c '/opt/Oracle/product/10.2.0/client_1/bin/tnsping database_name ' | grep OK;
PRC_EXT_STAT=$?;
# If Oracle is pingable, then startup WAS and break out of loop
if [ $PRC_EXT_STAT = "0" ]; then
echo -n "Starting Websphere Application Server: "
$websphered/startServer.sh $args
RETVAL=$?
if [ $RETVAL = 0 ]; then
touch /var/lock/subsys/websphered
echo_success
else
echo_failure
fi
#Break out of loop
break;
echo
fi
# Wait 30 seconds before checking again
echo " Waiting for Oracle connectivity: "
sleep 30
done
;;
stop)
echo -n "Shutting down websphered: "
$websphered/stopServer.sh $args -username $username -password $password
RETVAL=$?
if [ $RETVAL = 0 ]; then
rm -f /var/lock/subsys/websphered
echo_success
else
echo_failure
fi
echo
;;
restart)
$0 stop
$0 start
;;
status)
status $proc
;;
*)
echo "Usage: websphered {start|stop|restart|status}"
exit 1
esac
exit 0
LINK -->> http://nmkuttiady.blogspot.com/2009/01/websphere-startup-script-for-linux.html
#!/bin/bash
# Websphered # Startup script for IBM WebSphere Application Server
#
# chkconfig: - 99 15
# description: IBM's J2EE application server
# processname: websphered
# pidfile: /var/run/websphered.pid
# Source function library.
. /etc/rc.d/init.d/functions
websphered=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
args=server1
prog="WebSphere Application Server"
proc=/opt/IBM/WebSphere/AppServer/java/bin/java
RETVAL=0
username=user
password=password
# verify installation
if [ ! -x $websphered ]; then
echo "$prog is not installed"
exit 0
fi
# source function library
. /etc/rc.d/init.d/functions
case "$1" in
start)
# Continous loop to check Oracle connectivity. Websphere should come up only if Oracle is up.
for (( ; ; ))
do
# Check for Oracle connectivity
su - oracle -c '/opt/Oracle/product/10.2.0/client_1/bin/tnsping database_name ' | grep OK;
PRC_EXT_STAT=$?;
# If Oracle is pingable, then startup WAS and break out of loop
if [ $PRC_EXT_STAT = "0" ]; then
echo -n "Starting Websphere Application Server: "
$websphered/startServer.sh $args
RETVAL=$?
if [ $RETVAL = 0 ]; then
touch /var/lock/subsys/websphered
echo_success
else
echo_failure
fi
#Break out of loop
break;
echo
fi
# Wait 30 seconds before checking again
echo " Waiting for Oracle connectivity: "
sleep 30
done
;;
stop)
echo -n "Shutting down websphered: "
$websphered/stopServer.sh $args -username $username -password $password
RETVAL=$?
if [ $RETVAL = 0 ]; then
rm -f /var/lock/subsys/websphered
echo_success
else
echo_failure
fi
echo
;;
restart)
$0 stop
$0 start
;;
status)
status $proc
;;
*)
echo "Usage: websphered {start|stop|restart|status}"
exit 1
esac
exit 0
LINK -->> http://nmkuttiady.blogspot.com/2009/01/websphere-startup-script-for-linux.html
Friday, July 10, 2009
How to kill multiple java processes
ps -ef | grep java | grep -v grep | awk '{print $2}' | xargs kill -9
Subscribe to:
Posts (Atom)