Author: jfclere
Date: Sat Apr 23 12:07:40 2005
New Revision: 164409
URL: http://svn.apache.org/viewcvs?rev=164409&view=rev
Log:
Add logic to stop jsvcAdd logic to stop jsvc.
Modified:
jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c
Modified: jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c?rev=164409&r1=164408&r2=164409&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c
(original)
+++ jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c Sat
Apr 23 12:07:40 2005
@@ -413,6 +413,26 @@
}
/*
+ * stop the running jsvc
+ */
+static int stop_child(arg_data *args) {
+ int pid=get_pidf(args);
+ int count=10;
+ if (pid>0) {
+ /* kill the process and wait until the pidfile has been removed by the
controler */
+ kill(pid,SIGTERM);
+ while (count>0) {
+ sleep(6);
+ pid=get_pidf(args);
+ if (pid<=0)
+ return(0); /* JVM has stopped */
+ count--;
+ }
+ }
+ return(-1);
+}
+
+/*
* son process logic.
*/
@@ -559,6 +579,10 @@
/* Parse command line arguments */
args=arguments(argc,argv);
if (args==NULL) return(1);
+
+ /* Stop running jsvc if required */
+ if (args->stop==true)
+ return(stop_child(args));
/* Let's check if we can switch user/group IDs */
if (checkuser(args->user, &uid, &gid)==false) return(1);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]