Commit a37693d7 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

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;
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/", _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 @@
killall tmcd
if [ -f /var/run/ ]
kill `cat /var/run/`
rm -f /var/run/
sleep 1
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