CXX=g++
INSTALL=install
PROTOC=protoc
-CXXFLAGS=-Wall -O2 -g -pthread $(shell getconf LFS_CFLAGS)
-LDLIBS=-lprotobuf -pthread -lrt
+CXXFLAGS=-Wall -O2 -g -pthread $(shell getconf LFS_CFLAGS) $(shell pkg-config --cflags libsystemd)
+LDLIBS=-lprotobuf -pthread -lrt $(shell pkg-config --libs libsystemd)
OBJS=main.o client.o server.o stream.o udpstream.o serverpool.o mutexlock.o input.o input_stats.o httpinput.o udpinput.o parse.o config.o acceptor.o stats.o accesslog.o thread.o util.o log.o metacube2.o sa_compare.o state.pb.o
Description=Cubemap stream relay
[Service]
-Type=simple
+Type=notify
ExecStart=@prefix@/bin/cubemap @sysconfdir@/cubemap.config
User=cubemap
ExecReload=/bin/kill -HUP $MAINPID
#include <string.h>
#include <sys/time.h>
#include <sys/wait.h>
+#include <systemd/sd-daemon.h>
#include <unistd.h>
#include <algorithm>
#include <map>
log(INFO, "Re-exec happened in approx. %.0f ms.", glitch_time * 1000.0);
}
+ sd_notify(0, "READY=1");
+
while (!hupped) {
usleep(100000);
}
+ if (stopped) {
+ sd_notify(0, "STOPPING=1");
+ } else {
+ sd_notify(0, "RELOADING=1");
+ }
+
// OK, we've been HUPed. Time to shut down everything, serialize, and re-exec.
err = clock_gettime(CLOCK_MONOTONIC, &serialize_start);
assert(err != -1);