Tente isto:
#!/bin/sh
#
# chkconfig: 345 50 83
#
### BEGIN INIT INFO
# Short description: Trigger Beamer on system startup
# Description: Trigger blupay beamer on system start up
### END INIT INFO
#Source function library
. /etc/rc.d/init.d/functions
#targets beamer config file
if [ -f /etc/sysconfig/yourapp]; then
source /etc/sysconfig/yourapp
fi
#start httpd in the C locale by default.
YOURAPP_LANG=${YOURAPP_LANG-"java"}
# Path to .jar file.
yourapp=path/path_a/path_b
prog=app
pidfile=${PIDFILE-/var/run/yourapp/app.pid}
lockfile=${LOCKFILE-/var/lock/subsys/app}
RETVAL=0
start() {
echo -n "starting $prog"
LANG=${YOURAPP_LANG}
RETVAL=$?
java -jar ${yourapp}/yourjarfilename.jar
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d $app
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$BEAMER_LANG $app$OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $beamer due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $app -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"app shutdown"
fi
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $app
RETVAL=$?
;;
restart)
stop
start
;;
force-reload|reload)
reload
;;
*)
echo $"Usage: $prog {start|stop|restart||force-reload|reload|status}"
RETVAL=2
esac
exit $RETVAL
Vá para /etc/sysconfig/
, crie um arquivo yourapp
: Adicione o seguinte conteúdo:
#configuration file for blupay beamer
#
#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
# Add options only if you want to
#OPTIONS=
#
#
# By default, bemaer process is started in the java locale; to
# change the locale in which the server runs, the BEAMER_LANG
# variable can be set.
#
#YOURAPP_LANG=java
#
#
#By default, your app will create a app.pid
#
#PID_FILE=/var/run/app/appp.pid
#
Agora você deve poder executá-lo como:
sudo service app start
Certifique-se de substituir app
, YOURAPP
pelos nomes próprios