Skip to content

Instantly share code, notes, and snippets.

@zonia3000
Last active December 2, 2016 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zonia3000/84859460be987f3eb62d9194a956a336 to your computer and use it in GitHub Desktop.
Save zonia3000/84859460be987f3eb62d9194a956a336 to your computer and use it in GitHub Desktop.
GlassFish 4 System V init script
#!/bin/bash
#
# glassfish: Startup script for Glassfish Application Server.
#
# chkconfig: 3 80 05
# description: Startup script for domain1 of Glassfish Application Server.
ASADMIN="/home/glassfish/glassfish4/glassfish/bin/asadmin"
USER="glassfish"
# For SELinux we need to use 'runuser' not 'su'
if [ -x "/sbin/runuser" ]; then
SU="/sbin/runuser - -s /bin/sh"
else
SU="/bin/su - -s /bin/sh"
fi
case "$1" in
start)
$SU $USER -c "${ASADMIN} start-domain"
;;
stop)
$SU $USER -c "${ASADMIN} stop-domain"
;;
restart)
$SU $USER -c "${ASADMIN} stop-domain"
$SU $USER -c "${ASADMIN} start-domain"
;;
*)
echo "usage: $0 (start|stop|restart|help)"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment