Skip to content

Instantly share code, notes, and snippets.

@olivermt
Created October 17, 2011 09:48
Show Gist options
  • Select an option

  • Save olivermt/1292299 to your computer and use it in GitHub Desktop.

Select an option

Save olivermt/1292299 to your computer and use it in GitHub Desktop.
chkconfig --list
glassfish 0:off 1:off 2:off 3:on 4:off 5:off 6:off
mongodb 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cat /etc/inittab
id:3:initdefault:
#!/bin/bash
#
# glassfish: Startup script for Glassfish Application Server.
#
# chkconfig: 3 85 15
# description: Startup script for domain1 of Glassfish Application Server.
start() {
echo -n "Starting Glassfish: "
echo "Starting Glassfish at `date`" >> /home/glassfish/gf/glassfish/domains/domain1/logs/startup.log
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo -u glassfish /home/glassfish/gf/bin/asadmin start-domain >> /home/glassfish/gf/glassfish/domains/domain1/logs/startup.log
sleep 2
echo "done"
}
stop() {
echo -n "Stopping Glassfish: "
echo "Stopping Glassfish at `date`" >> /home/glassfish/gf/glassfish/domains/domain1/logs/startup.log
sudo -u glassfish /home/glassfish/gf/bin/asadmin stop-domain domain1 >> /home/glassfish/gf/glassfish/domains/domain1/logs/startup.log
echo "done"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: glassfish {start|stop|restart}"
exit
esac
#!/bin/sh
#
# mongodb This shell script stops and starts the mongodb database
#
#
# chkconfig: 3 80 20
# description: Startupscript for mongodb, uses a static config file
#
# processname: /home/glassfish/mongo/bin/mongod
# config: /home/glassfish/mongo/mongoconfig
OPTIONS="-f /home/glassfish/mongo/mongoconfig"
RETVAL=0
prog="mongod"
binary="/home/glassfish/mongo/bin/mongod"
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
sudo -u glassfish $binary $OPTIONS &
echo "done"
}
stop() {
[ -x $binary ] || exit 5
echo -n $"Stopping $prog: "
sudo -u glassfish killall mongod
echo "done"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: glassfish {start|stop|restart}"
exit
esac
@olivermt
Copy link
Author

These two services does not auto-start (they do stop correctly when you reboot/shut down system) on boot.
Any manual service glassfish start works just fine, but it will not autofire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment