Create a Java Daemon
Adam Tong
adam.tongu at gmail.com
Tue Feb 26 18:56:42 UTC 2013
Hi,
I added a script in /etc/init.d for my new service.
Now I want to have a way to determine if the service is running or not
for the status.
I checked the script of apache2 for example, I found that it relies on
this command to determine that: "pidof apache2 ..."
This does not work for my new service that I can start using "java
myprogram" in the start function of the service.
I guess that I am missing some step. Can you give me a hint?
Here is my service script content /etc/init.d/myservice:
---------------------
#!/bin/sh
start() {
echo “Starting myservice”
eval "java -classpath /home/me/Documents/projects/myproject/ JavaDaemonTest"
}
stop() {
echo “Stopping myservice”
}
restart() {
stop
start
}
status() {
echo "myservice is ... status to implement"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL
------
On Wed, Feb 20, 2013 at 12:12 PM, Steve Flynn <anothermindbomb at gmail.com> wrote:
> On 20 February 2013 17:03, Adam Tong <adam.tongu at gmail.com> wrote:
>
>> I looked over the net but the information is confusing. Can you tell
>> me how should I do that and maybe a link that explains the steps to
>> follow?
>
> http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html
>
>
> --
> Steve
>
> When one person suffers from a delusion it is insanity. When many
> people suffer from a delusion it is called religion.
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
More information about the ubuntu-users
mailing list