Results 1 to 2 of 2
We need to create a Linux service which has to be run in the background.
The service should run a java code. Startup and stop of this service should be ...
- 06-29-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 1
How to create a Linux service(daemon)
We need to create a Linux service which has to be run in the background.
The service should run a java code. Startup and stop of this service should be able to control manually.
Please help me out on this. It will be helpful if you provide the basic commands to create a service.
- 07-05-2007 #2
Try this....
Replace <myservice> with your daemon and put this script in /etc/init.d folder.
Code:#!/bin/sh # # myservice This shell script takes care of starting and stopping # the <myservice> # # Source function library . /etc/rc.d/init.d/functions # Do preliminary checks here, if any #### START of preliminary checks ######### ##### END of preliminary checks ####### # Handle manual control parameters like start, stop, status, restart, etc. case "$1" in start) # Start daemons. echo -n $"Starting <myservice> daemon: " echo daemon <myservice> echo ;; stop) # Stop daemons. echo -n $"Shutting down <myservice>: " killproc <myservice> echo # Do clean-up works here like removing pid files from /var/run, etc. ;; status) status <myservice> ;; restart) $0 stop $0 start ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esac exit 0---------------------------------
Registered Linux User #440311
HI2ARUN _AT_ GMAIL _DOT_ COM
---------------------------------



