BILL Carlisle
asked on
AIX - Can you verify my assumption? Create Script for Service (daemon)
Hi All,
This is my understanding to start glassfish4 as a service (or daemon) on AIX
$ vi /etc/rc.d/rc2.d
Enter the following:
Thank you in advance,
Bill
This is my understanding to start glassfish4 as a service (or daemon) on AIX
$ vi /etc/rc.d/rc2.d
Enter the following:
#!bin/bash
# description: Glassfish Start Stop Restart
# processname: glassfish
# chkconfig: 234 20 80
export JAVA_HOME=/usr/java71
PATH=$JAVA_HOME/bin:$PATH
export PATH
GLASSFISH_HOME=/u01/oracle/glassfish/glassfish
GLASSFISH_USER=glassfsh
case $1 in
start)
su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1"
;;
stop)
su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1"
;;
restart)
su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1"
su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1"
;;
esac
exit 0
Thank you in advance,
Bill
ASKER CERTIFIED 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
Awesome, so to test it
So on reboot of the server it automatically executes
/etc/rc.d/init.d/glassfish K11glassfish stop
/etc/rc.d/init.d/glassfish S11glassfish start
I don't have to do anything else?
I tested it this way:
# /etc/rc.d/init.d/glassfish restart
[YOU HAVE NEW MAIL]
Waiting for the domain to stop .
Command stop-domain executed successfully.
[YOU HAVE NEW MAIL]
Waiting for domain1 to start ........................
Successfully started the domain : domain1
domain Location: /u01/oracle/glassfish/glas sfish/doma ins/domain 1
Log File: /u01/oracle/glassfish/glas sfish/doma ins/domain 1/logs/ser ver.log
Admin Port: 4848
Command start-domain executed successfully.
and tried to test this way:
/etc/rc.d/init.d/glassfish K11glassfish stop
then I tried the GlassFish Admin - but the admin worked, wasn't stopped
Is the only wat to test it by actually rebooting the server?
Thanks N!
Bill
So on reboot of the server it automatically executes
/etc/rc.d/init.d/glassfish
/etc/rc.d/init.d/glassfish
I don't have to do anything else?
I tested it this way:
# /etc/rc.d/init.d/glassfish
[YOU HAVE NEW MAIL]
Waiting for the domain to stop .
Command stop-domain executed successfully.
[YOU HAVE NEW MAIL]
Waiting for domain1 to start ........................
Successfully started the domain : domain1
domain Location: /u01/oracle/glassfish/glas
Log File: /u01/oracle/glassfish/glas
Admin Port: 4848
Command start-domain executed successfully.
and tried to test this way:
/etc/rc.d/init.d/glassfish
then I tried the GlassFish Admin - but the admin worked, wasn't stopped
Is the only wat to test it by actually rebooting the server?
Thanks N!
Bill
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ohhh I got it.. ya duh,
/etc/rc.d/rc2.d/K11glassfi sh
is like an alias (link, duh)
to
/etc/rc.d/init.d/glassfish
so
/etc/rc.d/rc2.d/K11glassfi sh stop
should do it!
and it did:
/etc/rc.d/rc2.d/K11glassfi
is like an alias (link, duh)
to
/etc/rc.d/init.d/glassfish
so
/etc/rc.d/rc2.d/K11glassfi
should do it!
and it did:
# /etc/rc.d/rc2.d/K11glassfish stop
[YOU HAVE NEW MAIL]
Waiting for the domain to stop .
Command stop-domain executed successfully.
# /etc/rc.d/rc2.d/S11glassfish start
[YOU HAVE NEW MAIL]
Waiting for domain1 to start ...............
Successfully started the domain : domain1
domain Location: /u01/oracle/glassfish/glassfish/domains/domain1
Log File: /u01/oracle/glassfish/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Whoopee! Fine!
ASKER
you are the man! I'll close this.. thx again!
Thx for the points!
A little side note:
The "K" and "S" prefixes are only for AIX to know which parameter to pass to the script.
So
/etc/rc.d/rc2.d/S11glassfi sh stop
/etc/rc.d/rc2.d/K11glassfi sh start
issued from the command line would also work, counter-intuitevely!
N
A little side note:
The "K" and "S" prefixes are only for AIX to know which parameter to pass to the script.
So
/etc/rc.d/rc2.d/S11glassfi
/etc/rc.d/rc2.d/K11glassfi
issued from the command line would also work, counter-intuitevely!
N
ASKER
Thanks makes sense now!
ASKER
Ok, wouldn't you just
vi /etc/rc.d/init.d
Open in new window
paste the below script into it (i for insert), then save (:wq)
To "create softlinks" - just looked it up.. :)
ln -s S11_Glassfish /etc/rc.d/rc2.d
you may need to explain a bit more on the links?