Commit a37693d7 authored by Leigh Stoller's avatar Leigh Stoller

Write out a pidfile to /var/run, and use that in tmcd.restart to kill

the tmcd parent. killall was messing things up somewhow.
parent 0c628d00
......@@ -12,6 +12,7 @@
#include <stdarg.h>
#include <assert.h>
#include <sys/wait.h>
#include <paths.h>
#include <mysql/mysql.h>
#include "decls.h"
#include "config.h"
......@@ -61,7 +62,7 @@ int mydb_update(char *query, ...);
static int udpchild;
static int numchildren;
static int maxchildren = MINCHILDREN;
static int killme;
static volatile int killme;
#ifdef EVENTSYS
int myevent_send(address_tuple_t address);
......@@ -168,6 +169,8 @@ main(int argc, char **argv)
int tcpsock, udpsock, ch;
int length, i, status, pid;
struct sockaddr_in name;
FILE *fp;
char buf[BUFSIZ];
extern char build_info[];
while ((ch = getopt(argc, argv, "dp:c:")) != -1)
......@@ -274,6 +277,16 @@ main(int argc, char **argv)
signal(SIGINT, cleanup);
signal(SIGHUP, cleanup);
/*
* Stash the pid away.
*/
sprintf(buf, "%s/tmcd.pid", _PATH_VARRUN);
fp = fopen(buf, "w");
if (fp != NULL) {
fprintf(fp, "%d\n", getpid());
(void) fclose(fp);
}
/*
* Now fork a set of children to handle requests. We keep the
* pool at a set level. No need to get too fancy at this point.
......
......@@ -2,7 +2,12 @@
DIR=@prefix@/sbin
killall tmcd
if [ -f /var/run/tmcd.pid ]
then
kill `cat /var/run/tmcd.pid`
rm -f /var/run/tmcd.pid
fi
sleep 1
${DIR}/tmcd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment