[Xastir] Strange question....

Dan Brown brown at brauhaus.org
Mon Mar 7 06:25:19 EST 2005


On Mon, 7 Mar 2005, Curt Mills wrote:

> On Sun, 6 Mar 2005, Jim Shorney wrote:
> 
> > For reasons I won't go into, I would like to have cron stop and restart
> > Xastir periodically. Is this possible? Does anyone have a script handy
> > that would do that for me?
> 
> Never thought about doing that sort of thing, but if it was me I'd
> try installing a crontab for the user that's going to be running it,
> having it start up a login shell that then starts up Xastir.  That
> way you'll get all of your environment variables set properly that
> Xastir might need.
> 
> Stopping it:  I'd to a "ps" and a "grep" to find the two lines of
> interest (the shell you started and Xastir) and then snag the
> process ID's of each, issuing kill's to them.  Probably a kill -1
> first to each, then a kill -9 a few seconds later.  I'd write a
> script to do this and call the script from cron.

A quick 5 line patch, which might help here: 

 diff -u main.c.dist main.c 
--- main.c.dist 2005-03-07 06:17:56.000000000 -0500
+++ main.c      2005-03-07 06:19:51.000000000 -0500
@@ -28847,6 +28847,14 @@
 
     /* done checking user dirs */
 
+    /* Save our PID */
+    
+    FILE * MYPID ; 
+        
+    MYPID = fopen(get_user_base_dir("xastir.pid"),"w");
+    fprintf(MYPID, "%d",getpid()); 
+    fclose (MYPID);
+
     /* check fhs directories ?*/
 
     /* setup values */
@@ -29252,4 +29260,3 @@
     quit(0);
     return 0;
 }
-



(prolly need to add some code to remove the .pid file, at some point, too,
maybe after coffee...)


--
Dan Brown 
brown at brauhausdc.org




More information about the Xastir mailing list