Hi, I've developed a java application which i would like to enable as a linux service. so when i execute the command "service <my_application> start", it will be started as a service. I understand that I have to have a perl script in /etc/rc.d/init.d to do that, which I have already written. However, when I start up the service, it does not seem to be running.
I posted the script here. Can anyone help me look through it to see wat is wrong with it? Thanks
#!/bin/bash
#
# processname: msgfwd
#chkconfig: - 91 35
# source function library
. /etc/init.d/functions
RETVAL=0
prog="msgfwd"
start() {
export DISPLAY=10.10.10.192:0.0
echo -n $"Starting Message Forwarder: "
# The following line is to start my application
/MF/MF_v1.0/run_mf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/msgfwd
return $RETVAL
}
stop() {
echo -n $"Shutting down Message Forwarder: "
# The following command is a script is to stop my application
/home/ckahmun/MF_v1.0/kill_mf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/msgfwd
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
condrestart)
stop
start
;;
status)
# what do i add here?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $?
I posted the script here. Can anyone help me look through it to see wat is wrong with it? Thanks
#!/bin/bash
#
# processname: msgfwd
#chkconfig: - 91 35
# source function library
. /etc/init.d/functions
RETVAL=0
prog="msgfwd"
start() {
export DISPLAY=10.10.10.192:0.0
echo -n $"Starting Message Forwarder: "
# The following line is to start my application
/MF/MF_v1.0/run_mf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/msgfwd
return $RETVAL
}
stop() {
echo -n $"Shutting down Message Forwarder: "
# The following command is a script is to stop my application
/home/ckahmun/MF_v1.0/kill_mf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/msgfwd
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
condrestart)
stop
start
;;
status)
# what do i add here?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $?