设置glassfish开启自动domain

时间:2020-12-08 23:16:47

1-在/etc/rc.local中配置开机自启动

su - sumapay25 -c "/opt/glassfish.sh start 1"

2-/opt/glassfish.sh脚本如下

#!/bin/sh

ASADMIN="/home/sumapay25/glassfish4/glassfish/lib/nadmin"

case "$1" in
start)
    $ASADMIN start-domain --domaindir /home/sumapay25/glassfish4/glassfish/domains  domain1 &
    ;;
stop)
    $ASADMIN stop-domain --domaindir /home/sumapay25/glassfish4/glassfish/domains  domain1 &
    ;;
restart)
    $ASADMIN restart-domain --domaindir /home/sumapay25/glassfish4/glassfish/domains  domain1 &
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac