【init.dスクリプト作成例】
保存先:/etc/rc.d/init.d/
chmod +x スクリプト名で実行権限付与する
#!/bin/bash
#
# Startup script for the Apache Geronimo
#
# chkconfig: 345 80 15
# description: Geronimo is Apache's ASF-licensed J2EE server
# processname: geronimo
#
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
RETVAL=0
start(){
if [ -z $(/sbin/pidof java) ]; then
echo "Starting geronimo"
$GERONIMO_HOME/bin/startup.sh
touch /var/lock/subsys/geronimo
else
echo "geronimo allready running"
RETVAL=3
fi
}
stop(){
if [ ! -z $(/sbin/pidof java) ]; then
echo "Shutting down geronimo"
$GERONIMO_HOME/bin/shutdown.sh
until [ -z $(/sbin/pidof java) ]; do :; done
rm -f /var/lock/subsys/geronimo
else
echo "geronimo not running"
RETVAL=3
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
if [ -f /var/lock/subsys/geronimo ]; then
echo $"Apache Geronimo is enabled."
RETVAL=0
else
echo $"Apache Geronimo is disabled."
RETVAL=3
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
exit $RETVAL
このwikiの更新情報RSS