Friday Jan 09, 2009

StartUp init script - Sun Java Enteprise System 2005Q4 + Portal 7

Some time ago we deployed together with Sun Partner Sun Java Enteprise System 2005Q4 and Sun Java Portal Server 7, where Customer asked for deployment to be started automatically after Operating System boot.

(Solution script was posted already in this blog created by my fellow Lukas Cirkva in Czech Language. I'm adding some more technical informations for configuration steps and translation in English)

 
  

As a solution we have developed script (startJES provided below) to stop, start and restart Sun Java Enteprise System 2005Q4 and Sun Java Portal Server 7 services for Linux Operating System and identified configuration steps recorded below for automatic start.

Startup script manages following Java ES Products and Services:

  • Sun Java Portal Server 7 with Sun Java Application Server 8.1
  • Portal Server SRA Rewriter Proxy
  • Portal Server SRA Gateway
  • Directory Server 5.2p4 instance
  • Administration Server (for DS5.2)
  • Common Agent Container (CACAO)

You will need to perform following steps to configure the script to start after system boot (steps have been done for Red Hat Enterprise Server 3.0):

  1. Copy script startJES to /etc/ini.d directory
    [root@localhost root]#cp startJES /etc/init.d
  2. Create symbolic link from rc.3 (Multi-user mode (Text login) dedicated for server side processes)
    [root@localhost root]#cd ../rc3.d
    [root@localhost root]#ln -s ../init.d/startJES S80javaES
  3. update runlevel information for system services with the script
    [root@localhost root]#chkconfig --add startJES
  4. mark it for start
$ntsysv

That's it! 


Script startJES recorded below:


#!/bin/sh

# chkconfig: - 80 80
# description: This script is used as a startup script.
# processname: startJES
# Java Enterprise Services installed on this server can be managed using this script

final_exit_code=0

case "$1" in
   start)
    
	# start Administration Server
	/var/opt/sun/directory-server/start-admin 2>&1

	# start Directory Server
	/var/opt/sun/directory-server/slapd-server/start-slapd 2>&1

	# start CACAO
	/opt/sun/cacao/bin/cacaoadm start 2>&1

	# start Application Server - instance
	#need to create /opt/sun/appserver/config/.passwd file with content "AS_ADMIN_PASSWORD="
	/opt/sun/appserver/bin/asadmin start-domain --user admin  --passwordfile /opt/sun/appserver/config/.passwd domain1 2>&1

	# start Portal Server SRA Rewriter Proxy
	/opt/sun/portal/bin/psadmin start-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type rwproxy 2>&1

	# start Portal Server SRA Gateway
	/opt/sun/portal/bin/psadmin start-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type gateway 2>&1

	exit ${final_exit_code}
	;;
   stop)

	# stop Portal Server SRA Gateway
	/opt/sun/portal/bin/psadmin stop-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type gateway 2>&1

	# stop Portal Server SRA Rewriter Proxy
	/opt/sun/portal/bin/psadmin stop-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type rwproxy 2>&1

	# stop Application Server - instance
	/opt/sun/appserver/bin/asadmin stop-domain  domain1 2>&1

	# stop CACAO
	/opt/sun/cacao/bin/cacaoadm stop 2>&1

	# stop Directory Server
	/var/opt/sun/directory-server/slapd-server/stop-slapd 2>&1

	# stop Administration Server
	/var/opt/sun/directory-server/stop-admin 2>&1
	
	exit ${final_exit_code}
	;;

   restart)
	# Stop All Java ES Services
	# stop Portal Server SRA Gateway
	/opt/sun/portal/bin/psadmin stop-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type gateway 2>&1
	
	# stop Portal Server SRA Rewriter Proxy
	/opt/sun/portal/bin/psadmin stop-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type rwproxy 2>&1

	# stop Application Server - instance
	/opt/sun/appserver/bin/asadmin stop-domain  domain1 2>&1

	# stop CACAO
	/opt/sun/cacao/bin/cacaoadm stop 2>&1

	# stop Directory Server
	/var/opt/sun/directory-server/slapd-server/stop-slapd 2>&1

	# stop Administration Server
	/var/opt/sun/directory-server/stop-admin 2>&1


	#Start All Java ES Services
	# start Administration Server
	/var/opt/sun/directory-server/start-admin 2>&1

	# start Directory Server
	/var/opt/sun/directory-server/slapd-server/start-slapd 2>&1

	# start CACAO
	/opt/sun/cacao/bin/cacaoadm start 2>&1

	# start Application Server - instance
	#need to create /opt/sun/appserver/config/.passwd file with content "AS_ADMIN_PASSWORD="
	/opt/sun/appserver/bin/asadmin start-domain --user admin  --passwordfile /opt/sun/appserver/config/.passwd domain1 2>&1

	# start Portal Server SRA Rewriter Proxy
	/opt/sun/portal/bin/psadmin start-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type rwproxy 2>&1

	# start Portal Server SRA Gateway
	/opt/sun/portal/bin/psadmin start-sra-instance --adminuser amadmin --passwordfile /opt/sun/portal/admin/.pwdfile --name default --type gateway 2>&1

	exit ${final_exit_code}
	;;

   \*)
	if [ -z $1 ]
	then
		echo "Usage: $0 {start|stop|restart}" >&2
	fi
	exit 1
	;;
esac
                                                                                
exit 0
About

Rasta's little things related to Java ES. Interoperability and Compatibility are the main themes.

Search

Archives
« January 2009 »
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today